CategoryView
Extends \Joomla\CMS\MVC\View\HtmlViewBase HTML View class for the a Category list
Class holding methods for displaying presentation data.
since |
3.2 |
---|
Methods
__construct
Constructor
__construct(array $config = array())
since |
3.0 |
---|
Arguments
- $config
array
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
_addPath
Adds to the search path for templates and resources.
_addPath(string $type, mixed $path) : void
since |
3.0 |
---|
Arguments
- $type
string
The type of path to add.- $path
mixed
The directory or stream, or an array of either, to search.
_createFileName
Create the filename for a resource
_createFileName(string $type, array $parts = array()) : string
since |
3.0 |
---|
Arguments
- $type
string
The resource type to create the filename for- $parts
array
An associative array of filename information
Response
string
The filename
_setPath
Sets an entire array of search paths for templates or resources.
_setPath(string $type, mixed $path) : void
since |
3.0 |
---|
Arguments
- $type
string
The type of path to set, typically 'template'.- $path
mixed
The new search path, or an array of search paths. If null or false, resets to the current directory only.
addFeed
Method to add an alternative feed link to a category layout.
addFeed() : void
since |
3.2 |
---|
addHelperPath
Adds to the stack of helper script paths in LIFO order.
addHelperPath(mixed $path) : void
since |
3.0 |
---|
Arguments
- $path
mixed
A directory path or an array of paths.
addTemplatePath
Adds to the stack of view script paths in LIFO order.
addTemplatePath(mixed $path) : void
since |
3.0 |
---|
Arguments
- $path
mixed
A directory path or an array of paths.
assign
Assigns variables to the view script via differing strategies.
assign() : boolean
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);
since |
3.0 |
---|---|
deprecated |
3.0 Use native PHP syntax. |
Response
boolean
True on success, false on failure.
assignRef
Assign variable for the view (by reference).
assignRef(string $key, &$val) : boolean
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;
since |
3.0 |
---|---|
deprecated |
3.0 Use native PHP syntax. |
Arguments
- $key
string
The name for the reference in the view.- $val
Response
boolean
True on success, false on failure.
commonCategoryDisplay
Method with common display elements used in category list displays
commonCategoryDisplay() : boolean|\JException|void
since |
3.2 |
---|
Response
boolean|\JException|void
Boolean false or \JException instance on error, nothing otherwise
display
Execute and display a template script.
display(string $tpl = null) : mixed
see | \JViewLegacy::loadTemplate() |
---|---|
since |
3.0 |
Arguments
- $tpl
string
The name of the template file to parse; automatically searches through the template paths.
Response
mixed
A string if successful, otherwise an Error object.
escape
Escapes a value for output in a view script.
escape(mixed $var) : mixed
If escaping mechanism is either htmlspecialchars or htmlentities, uses \$_encoding setting.
note |
the ENT_COMPAT flag will be replaced by ENT_QUOTES in Joomla 4.0 to also escape single quotes |
---|---|
since |
3.0 |
Arguments
- $var
mixed
The output to escape.
Response
mixed
The escaped value.
get
Method to get data from a registered model or a property of the view
get(string $property, string $default = null) : mixed
since |
3.0 |
---|
Arguments
- $property
string
The name of the method to call on the model or the property to get- $default
string
The name of the model to reference or the default value [optional]
Response
mixed
The return value of the method
getForm
Returns the form object
getForm() : mixed
since |
3.2 |
---|
Response
mixed
A \JForm object on success, false on failure
getLayout
Get the layout.
getLayout() : string
since |
3.0 |
---|
Response
string
The layout name
getLayoutTemplate
Get the layout template.
getLayoutTemplate() : string
since |
3.0 |
---|
Response
string
The layout template name
getModel
Method to get the model object
getModel(string $name = null) : mixed
since |
3.0 |
---|
Arguments
- $name
string
The name of the model (optional)
Response
mixed
\JModelLegacy object
getName
Method to get the view name
getName() : string
The model name by default parsed using the classname, or it can be set by passing a $config['name'] in the class constructor
since |
3.0 |
---|---|
throws |
|
Response
string
The name of the model
loadHelper
Load a helper file
loadHelper(string $hlp = null) : void
since |
3.0 |
---|
Arguments
- $hlp
string
The name of the helper source file automatically searches the helper paths and compiles as needed.
loadTemplate
Load a template file -- first look in the templates folder for an override
loadTemplate(string $tpl = null) : string
since |
3.0 |
---|---|
throws |
|
Arguments
- $tpl
string
The name of the template source file; automatically searches the template paths and compiles as needed.
Response
string
The output of the the template script.
prepareDocument
Method to prepares the document
prepareDocument() : void
since |
3.2 |
---|
setDocumentTitle
Sets the document title according to Global Configuration options
setDocumentTitle(string $title) : void
since |
3.6 |
---|
Arguments
- $title
string
The page title
setEscape
Sets the _escape() callback.
setEscape(mixed $spec) : void
since |
3.0 |
---|---|
deprecated |
3.0 Override \JViewLegacy::escape() instead. |
Arguments
- $spec
mixed
The callback for _escape() to use.
setLayout
Sets the layout name to use
setLayout(string $layout) : string
since |
3.0 |
---|
Arguments
- $layout
string
The layout name or a string in format :
Response
string
Previous value.
setLayoutExt
Allows a different extension for the layout files to be used
setLayoutExt(string $value) : string
since |
3.0 |
---|
Arguments
- $value
string
The extension.
Response
string
Previous value
setModel
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.
setModel(\JModelLegacy $model, boolean $default = false) : \JModelLegacy
since |
3.0 |
---|
Arguments
- $model
\JModelLegacy
The model to add to the view.- $default
boolean
Is this the default model?
Response
\JModelLegacy
The added model.
Properties
items
Category items data
since |
3.2 |
---|
Type(s)
array
category
The category model object for this category
since |
3.2 |
---|
Type(s)
\JModelCategory
categories
The list of other categories for this extension.
since |
3.2 |
---|
Type(s)
array
pagination
Pagination object
since |
3.2 |
---|
Type(s)
\JPagination
children
Child objects
since |
3.2 |
---|
Type(s)
array
extension
The name of the extension for the category
since |
3.2 |
---|
Type(s)
string
viewName
The name of the view to link individual items to
since |
3.2 |
---|
Type(s)
string
defaultPageTitle
Default title to use for page title
since |
3.2 |
---|
Type(s)
string
runPlugins
Whether to run the standard Joomla plugin events.
Off by default for b/c
since |
3.5 |
---|
Type(s)
boolean
document
The active document object
since |
3.0 |
---|
Type(s)
\JDocument
_name
The name of the view
since |
3.0 |
---|
Type(s)
array
_models
Registered models
since |
3.0 |
---|
Type(s)
array
_basePath
The base path of the view
since |
3.0 |
---|
Type(s)
string
_defaultModel
The default model
since |
3.0 |
---|
Type(s)
string
_layout
Layout name
since |
3.0 |
---|
Type(s)
string
_layoutExt
Layout extension
since |
3.0 |
---|
Type(s)
string
_layoutTemplate
Layout template
since |
3.0 |
---|
Type(s)
string
_path
The set of search directories for resources (templates)
since |
3.0 |
---|
Type(s)
array
_template
The name of the default template source file.
since |
3.0 |
---|
Type(s)
string
_output
The output of the template script.
since |
3.0 |
---|
Type(s)
string
_escape
Callback for escaping.
since |
3.0 |
---|---|
deprecated |
3.0 |
Type(s)
string
_charset
Charset to use in escaping mechanisms; defaults to urf8 (UTF-8)
since |
3.0 |
---|
Type(s)
string