Support Joomla!

references:joomla.framework:application:jview-setmodel

Table of Contents

setModel

API Package Subpackage Class Method Reference Last reviewed Doc status
API Home Package Joomla.Framework Subpackage Application Class JView Method setModel Reference setModel() Never Work in Progress

Adds a model to the view. The system supports a multiple model single view system by which models are referenced by classname. A caveat to the classname referencing is that any classname prepended by JModel will be referenced by the name without JModel, eg. JModelCategory is just Category.

The method returns a reference to the JModel object that was added to the view.

Syntax

JModel &setModel ( &$model, $default, $model )

$model JModel is the JModel object to add to the view.

$default boolean is a boolean value that specifies whether or not the added model should be made the default model.

Examples

The setModel method could be called in the following way from within the JController class:

Example

// Push a model into the view
$model	= &$this->getModel( $viewName );
if (!JError::isError( $model )) {
	$view->setModel( $model, true );
}

 
references/joomla.framework/application/jview-setmodel.txt (10175 views) · Last modified: 2007/08/15 14:49