Base class for a Joomla View
Class holding methods for displaying presentation data.
- Depuis
- 2.5.5
◆ __construct()
__construct |
( |
|
$config = array() | ) |
|
Constructor
- Paramètres
-
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 |
- Depuis
- 3.0
Références $config, et elseif.
◆ _addPath()
_addPath |
( |
|
$type, |
|
|
|
$path |
|
) |
| |
|
protected |
Adds to the search path for templates and resources.
- Paramètres
-
string | $type | The type of path to add. |
mixed | $path | The directory or stream, or an array of either, to search. |
- Renvoie
- void
- Depuis
- 3.0
Références $path, $type, DIRECTORY_SEPARATOR, et jimport().
◆ _createFileName()
_createFileName |
( |
|
$type, |
|
|
|
$parts = array() |
|
) |
| |
|
protected |
Create the filename for a resource
- Paramètres
-
string | $type | The resource type to create the filename for |
array | $parts | An associative array of filename information |
- Renvoie
- string The filename
- Depuis
- 3.0
Références $parts, et $type.
◆ _setPath()
_setPath |
( |
|
$type, |
|
|
|
$path |
|
) |
| |
|
protected |
Sets an entire array of search paths for templates or resources.
- Paramètres
-
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. |
- Renvoie
- void
- Depuis
- 3.0
Références $app, $component, $path, $type, et JPATH_THEMES.
◆ addHelperPath()
Adds to the stack of helper script paths in LIFO order.
- Paramètres
-
mixed | $path | A directory path or an array of paths. |
- Renvoie
- void
- Depuis
- 3.0
Références $path.
◆ addTemplatePath()
Adds to the stack of view script paths in LIFO order.
- Paramètres
-
mixed | $path | A directory path or an array of paths. |
- Renvoie
- void
- Depuis
- 3.0
Références $path.
◆ 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 or private variables within the template script itself.
$view = new ;
// 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 ; $obj->var1 = 'something'; $obj->var2 = 'else'; $view->assign($obj);
- Renvoie
- boolean True on success, false on failure.
- Depuis
- 3.0
- Obsolète:
- 3.0 Use native PHP syntax.
Références $key.
◆ assignRef()
assignRef |
( |
|
$key, |
|
|
& |
$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 or private variables within the template script itself.
$view = new ;
// Assign by name and value $view->assignRef('var1', $ref);
// Assign directly $view->var1 =
- Paramètres
-
string | $key | The name for the reference in the view. |
mixed | &$val | The referenced variable. |
- Renvoie
- boolean True on success, false on failure.
- Depuis
- 3.0
- Obsolète:
- 3.0 Use native PHP syntax.
Références $key.
◆ display()
Execute and display a template script.
- Paramètres
-
string | $tpl | The name of the template file to parse; automatically searches through the template paths. |
- Renvoie
- mixed A string if successful, otherwise an Error object.
- Voir également
- ::loadTemplate()
- Depuis
- 3.0
◆ escape()
Escapes a value for output in a view script.
If escaping mechanism is either htmlspecialchars or htmlentities, uses $_encoding setting.
- Paramètres
-
mixed | $var | The output to escape. |
- Renvoie
- mixed The escaped value.
- Note
- the ENT_COMPAT flag will be replaced by ENT_QUOTES in Joomla 4.0 to also escape single quotes
- Depuis
- 3.0
Références ENT_COMPAT.
◆ get()
get |
( |
|
$property, |
|
|
|
$default = null |
|
) |
| |
Method to get data from a registered model or a property of the view
- Paramètres
-
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] |
- Renvoie
- mixed The return value of the method
- Depuis
- 3.0
Références $default, et null.
◆ getForm()
Returns the form object
- Renvoie
- mixed A object on success, false on failure
- Depuis
- 3.2
Références $form.
◆ getLayout()
Get the layout.
- Renvoie
- string The layout name
- Depuis
- 3.0
◆ getLayoutTemplate()
Get the layout template.
- Renvoie
- string The layout template name
- Depuis
- 3.0
◆ getModel()
Method to get the model object
- Paramètres
-
string | $name | The name of the model (optional) |
- Renvoie
- mixed object
- Depuis
- 3.0
Références $name, et null.
◆ 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
- Renvoie
- string The name of the model
- Depuis
- 3.0
- Exceptions
-
◆ loadHelper()
loadHelper |
( |
|
$hlp = null | ) |
|
Load a helper file
- Paramètres
-
string | $hlp | The name of the helper source file automatically searches the helper paths and compiles as needed. |
- Renvoie
- void
- Depuis
- 3.0
Références $file, et jimport().
◆ loadTemplate()
loadTemplate |
( |
|
$tpl = null | ) |
|
◆ setDocumentTitle()
setDocumentTitle |
( |
|
$title | ) |
|
Sets the document title according to Global Configuration options
- Paramètres
-
string | $title | The page title |
- Renvoie
- void
- Depuis
- 3.6
Références $app, $title, et elseif.
◆ setEscape()
Sets the _escape() callback.
- Paramètres
-
mixed | $spec | The callback for _escape() to use. |
- Renvoie
- void
- Depuis
- 3.0
- Obsolète:
- 3.0 Override ::escape() instead.
◆ setLayout()
Sets the layout name to use
- Paramètres
-
string | $layout | The layout name or a string in format <template>:<layout file>=""> |
- Renvoie
- string Previous value.
- Depuis
- 3.0
Références $layout.
◆ setLayoutExt()
Allows a different extension for the layout files to be used
- Paramètres
-
string | $value | The extension. |
- Renvoie
- string Previous value
- Depuis
- 3.0
Références $value.
◆ setModel()
setModel |
( |
|
$model, |
|
|
|
$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 will be referenced by the name without , eg. is just Category.
- Paramètres
-
\JModelLegacy | $model | The model to add to the view. |
boolean | $default | Is this the default model? |
- Renvoie
- The added model.
- Depuis
- 3.0
Références $default, et $name.
◆ $_basePath
◆ $_charset
◆ $_defaultModel
◆ $_escape
◆ $_layout
◆ $_layoutExt
◆ $_layoutTemplate
◆ $_models
◆ $_name
◆ $_output
◆ $_path
$_path = array('template' => array(), 'helper' => array()) |
|
protected |
◆ $_template
◆ $document
La documentation de cette classe a été générée à partir du fichier suivant :