JController/display
From Joomla! Documentation
< API16:JController
The "API16" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.
Description[edit]
Typical view method for MVC based architecture
Template:Description:JController/display
Syntax[edit]
display($cachable=false)
Parameter Name | Default Value | Description |
---|---|---|
$cachable | false | $cachable If true, the view output will be cached |
Defined in[edit]
libraries/joomla/application/component/controller.php
Importing[edit]
jimport( 'joomla.application.component.controller' );
Source Body[edit]
public function display($cachable = false)
{
$document = &JFactory::getDocument();
$viewType = $document->getType();
$viewName = JRequest::getCmd('view', $this->getName());
$viewLayout = JRequest::getCmd('layout', 'default');
$view = & $this->getView($viewName, $viewType, '', array('base_path'=>$this->_basePath));
// Get/Create the model
if ($model = & $this->getModel($viewName)) {
// Push the model into the view (as default)
$view->setModel($model, true);
}
// Set the layout
$view->setLayout($viewLayout);
// Display the view
if ($cachable && $viewType != 'feed') {
global $option;
$cache = &JFactory::getCache($option, 'view');
$cache->get($view, 'display');
} else {
$view->display();
}
}
[Edit See Also] Template:SeeAlso:JController/display
Examples[edit]
<CodeExamplesForm />