Actions

API16

JController/display

From Joomla! Documentation

< API16:JController
Revision as of 20:56, 12 May 2013 by JoomlaWikiBot (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Replacement filing cabinet.png
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.

Contents

Description

Typical view method for MVC based architecture

[<! removed edit link to red link >]

<! removed transcluded page call, red link never existed >

Syntax

display($cachable=false)
Parameter Name Default Value Description
$cachable false $cachable If true, the view output will be cached

Defined in

libraries/joomla/application/component/controller.php

Importing

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

Source Body

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();
        }
}

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples

<CodeExamplesForm />