API15

JView/getModel: Difference between revisions

From Joomla! Documentation

Doxiki (talk | contribs)
New page: ===Description=== Method to get the model object <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>Edit Descripton<nowiki>]</nowiki> ...
 
Doxiki (talk | contribs)
No edit summary
Line 9: Line 9:


===Syntax===
===Syntax===
<source lang="php">getModel($name=null)</source>
<source lang="php">& getModel($name=null)</source>


  {| class="wikitable"
  {| class="wikitable"
Line 32: Line 32:
===Source Body===
===Source Body===
<source lang="php">
<source lang="php">
function getModel($name = null)
function &getModel( $name = null )
{
{
         if ($name === null) {
         if ($name === null) {
                 $name = $this->_defaultModel;
                 $name = $this->_defaultModel;
         }
         }
         return $this->_models[strtolower($name)];
         return $this->_models[strtolower( $name )];
}
}
</source>
</source>

Revision as of 22:10, 22 March 2010

Description

Method to get the model object

[Edit Descripton]

Template:Description:JView/getModel

Syntax

& getModel($name=null)
Parameter Name Default Value Description
$name null $name The name of the model (optional)

Returns

mixed object

Defined in

libraries/joomla/application/component/view.php

Importing

jimport( 'joomla.application.component.view' );

Source Body

function &getModel( $name = null )
{
        if ($name === null) {
                $name = $this->_defaultModel;
        }
        return $this->_models[strtolower( $name )];
}

[Edit See Also] Template:SeeAlso:JView/getModel

Examples

<CodeExamplesForm />