JView
Base class for a Joomla View
Class holding methods for displaying presentation data.
Located in /joomla/application/component/view.php (line 28)
JObject (Subpackage Base)
![]()
JView (Subpackage Application)
string
$_basePath
= null (line 52)
The base path of the view
string
$_defaultModel
= null (line 60)
The default model
string
$_layout
= 'default' (line 68)
Layout name
string
$_layoutExt
= 'php' (line 76)
Layout extension
array
$_models
= array() (line 44)
Registered models
array
$_name
= null (line 36)
The name of the view
array
$_path
= array('template' => array(),'helper'=>array()) (line 84)
The set of search directories for resources (templates)
Inherited Variables
Inherited from JObject
JObject::$_errors
Constructor
- $config
- JObject::__construct()
- Class constructor, overridden in descendant classes.
Adds to the stack of helper script paths in LIFO order.
- string|array $path: The directory (-ies) to add.
Adds to the stack of view script paths in LIFO order.
- string|array $path: The directory (-ies) to add.
Assigns variables to the view script via differing strategies.
This method is overloaded; you can assign all the properties of an object, an associative array, or a single value by name.
You are not allowed to set variables that begin with an underscore; these are either private properties for JView or private variables within the template script itself.
- // assign directly
- $view->var1 = 'something';
- $view->var2 = 'else';
- // assign by name and value
- // assign by assoc-array
- $ary = array('var1' => 'something', 'var2' => 'else');
- // assign by object
- $obj = new stdClass;
- $obj->var1 = 'something';
- $obj->var2 = 'else';
Assign variable for the view (by reference).
You are not allowed to set variables that begin with an underscore; these are either private properties for JView or private variables within the template script itself.
- // assign by name and value
- // assign directly
- $view->ref =& $var1;
- string $key: The name for the reference in the view.
- mixed &$val: The referenced variable.
Execute and display a template script.
- string $tpl: The name of the template file to parse; automatically searches through the template paths.
Escapes a value for output in a view script.
If escaping mechanism is one of htmlspecialchars or htmlentities, uses $_encoding setting.
- mixed $var: The output to escape.
Method to get data from a registered model or a property of the view
- string $property: The name of the method to call on the model, or the property to get
- string $default: The name of the model to reference, or the default value [optional]
- JObject::get()
- Returns a property of the object or the default value if the property is not set.
Method to get the model object
- string $name: The name of the model (optional)
Method to get the view name
The model name by default parsed using the classname, or it can be set by passing a $config['name'] in the class constructor
Load a helper file
- string $tpl: The name of the helper source file ... automatically searches the helper paths and compiles as needed.
- $hlp
Load a template file -- first look in the templates folder for an override
- string $tpl: The name of the template source file ... automatically searches the template paths and compiles as needed.
Sets the _escape() callback.
- mixed $spec: The callback for _escape() to use.
Sets the layout name to use
- string $template: The template name.
- $layout
Allows a different extension for the layout files to be used
- string $value: The extension
Method to add a model to the view. We support 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.
- object $model: The model to add to the view.
- boolean $default: Is this the default model?
- &$model
Adds to the search path for templates and resources.
- string|array $path: The directory or stream to search.
- $type
Sets an entire array of search paths for templates or resources.
- string $type: The type of path to set, typically 'template'.
- string|array $path: The new set of search paths. If null or false, resets to the current directory only.
Inherited Methods
Inherited From JObject
JObject::JObject()
JObject::__construct()
JObject::get()
JObject::getError()
JObject::getErrors()
JObject::getProperties()
JObject::getPublicProperties()
JObject::set()
JObject::setError()
JObject::setProperties()
JObject::toString()





JView (Subpackage Application)