JView
Base class for a Joomla View
Class holding methods for displaying presentation data.
Located in /libraries/joomla/application/component/view.php (line 21)
JObject (Subpackage Base)
![]()
JView (Subpackage Application)
string
$basePath
= null (line 58)
The base path of the view
string
$charset
= 'UTF-8' (line 193)
Charset to use in escaping mechanisms; defaults to urf8 (UTF-8)
string
$defaultModel
= null (line 73)
The default model
string
$escape
= 'htmlspecialchars' (line 178)
Callback for escaping.
string
$layout
= 'default' (line 88)
Layout name
string
$layoutExt
= 'php' (line 103)
Layout extension
string
$layoutTemplate
= '_' (line 118)
Layout template
array
$models
= array() (line 43)
Registered models
array
$name
= null (line 28)
The name of the view
string
$output
= null (line 163)
The output of the template script.
array
$path
= array('template' => array(),'helper'=>array()) (line 133)
The set of search directories for resources (templates)
string
$template
= null (line 148)
The name of the default template source file.
string
$_basePath
= null (line 66)
The base path of the view
string
$_charset
= 'UTF-8' (line 201)
Charset to use in escaping mechanisms; defaults to urf8 (UTF-8)
string
$_defaultModel
= null (line 81)
The default model
string
$_escape
= 'htmlspecialchars' (line 186)
Callback for escaping.
string
$_layout
= 'default' (line 96)
Layout name
string
$_layoutExt
= 'php' (line 111)
Layout extension
string
$_layoutTemplate
= '_' (line 126)
Layout template
array
$_models
= array() (line 51)
Registered models
array
$_name
= null (line 36)
The name of the view
string
$_output
= null (line 171)
The output of the template script.
array
$_path
= array('template' => array(),'helper'=>array()) (line 141)
The set of search directories for resources (templates)
string
$_template
= null (line 156)
The name of the default template source file.
Inherited Variables
Inherited from JObject
JObject::$_errors
Constructor
-
array
$config: A named configuration array for object construction.
name: the name (optional) of the view (defaults to the view class name suffix).
charset: the character set to use for display
escape: the name (optional) of the function to use for escaping strings
base_path: the parent path (optional) of the views directory (defaults to the component folder)
template_plath: the path (optional) of the layout directory (defaults to base_path + /views/ + view name
helper_path: the path (optional) of the helper files (defaults to base_path + /helpers/)
layout: the layout (optional) to use to display the view
- JObject::__construct()
- Class constructor, overridden in descendant classes.
Adds to the stack of helper script paths in LIFO order.
- mixed $path: A directory path or an array of paths.
Adds to the stack of view script paths in LIFO order.
- mixed $path: A directory path or an array of paths.
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 either 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 $hlp: The name of the helper source file automatically searches the helper paths and compiles as needed.
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 $layout: The layout name or a string in format <template>:<layout file>
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?
Adds to the search path for templates and resources.
- string $type: The type of path to add.
- mixed $path: The directory or stream, or an array of either, to search.
Create the filename for a resource
- string $type: The resource type to create the filename for
- array $parts: An associative array of filename information
Sets an entire array of search paths for templates or resources.
- string $type: The type of path to set, typically 'template'.
- mixed $path: The new search path, or an array of search paths. If null or false, resets to the current directory only.
Inherited Methods
Inherited From JObject
JObject::__construct()
JObject::def()
JObject::get()
JObject::getError()
JObject::getErrors()
JObject::getProperties()
JObject::set()
JObject::setError()
JObject::setProperties()
JObject::toString()
JObject::__toString()
