CategoriesView
class CategoriesView extends HtmlView
Categories view base class.
Properties
JDocument | $document | The active document object | from HtmlView |
Methods
Execute and display a template script.
Assign variable for the view (by reference).
Method to get data from a registered model or a property of the view
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.
Allows a different extension for the layout files to be used
Adds to the stack of view script paths in LIFO order.
Adds to the stack of helper script paths in LIFO order.
Load a template file -- first look in the templates folder for an override
Sets the document title according to Global Configuration options
Details
boolean
assign()
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.
$view = new \Joomla\CMS\View\HtmlView;
// Assign directly
$view->var1 = 'something';
$view->var2 = 'else';
// Assign by name and value
$view->assign('var1', 'something');
$view->assign('var2', 'else');
// Assign by assoc-array
$ary = array('var1' => 'something', 'var2' => 'else');
$view->assign($obj);
// Assign by object
$obj = new \stdClass;
$obj->var1 = 'something';
$obj->var2 = 'else';
$view->assign($obj);
boolean
assignRef(
string $key,
mixed $val)
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.
$view = new \JView;
// Assign by name and value
$view->assignRef('var1', $ref);
// Assign directly
$view->var1 = &$ref;
mixed
escape(
mixed $var)
Escapes a value for output in a view script.
If escaping mechanism is either htmlspecialchars or htmlentities, uses {@link $_encoding} setting.
mixed
get(
string $property,
string $default = null)
Method to get data from a registered model or a property of the view
string
getName()
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
JModelLegacy
setModel(
JModelLegacy $model,
boolean $default = false)
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.