Joomla CMS  3.8.5 (avec JPlatform 13.1 inclus)
Documentation des API du CMS Joomla en version 3.8.5 et du framework Joomla Platform intégré
Référence de la classe HtmlView
+ Graphe d'héritage de HtmlView:

Fonctions membres publiques

 __construct ($config=array())
 
 display ($tpl=null)
 
 assign ()
 
 assignRef ($key, &$val)
 
 escape ($var)
 
 get ($property, $default=null)
 
 getModel ($name=null)
 
 getLayout ()
 
 getLayoutTemplate ()
 
 getName ()
 
 setModel ($model, $default=false)
 
 setLayout ($layout)
 
 setLayoutExt ($value)
 
 setEscape ($spec)
 
 addTemplatePath ($path)
 
 addHelperPath ($path)
 
 loadTemplate ($tpl=null)
 
 loadHelper ($hlp=null)
 
 getForm ()
 
 setDocumentTitle ($title)
 

Champs de données

 $document
 

Fonctions membres protégées

 _setPath ($type, $path)
 
 _addPath ($type, $path)
 
 _createFileName ($type, $parts=array())
 

Attributs protégés

 $_name = null
 
 $_models = array()
 
 $_basePath = null
 
 $_defaultModel = null
 
 $_layout = 'default'
 
 $_layoutExt = 'php'
 
 $_layoutTemplate = '_'
 
 $_path = array('template' => array(), 'helper' => array())
 
 $_template = null
 
 $_output = null
 
 $_escape = 'htmlspecialchars'
 
 $_charset = 'UTF-8'
 

Description détaillée

Base class for a Joomla View

Class holding methods for displaying presentation data.

Depuis
2.5.5

Documentation des constructeurs et destructeur

◆ __construct()

__construct (   $config = array())

Constructor

Paramètres
array$configA 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.

Documentation des fonctions membres

◆ _addPath()

_addPath (   $type,
  $path 
)
protected

Adds to the search path for templates and resources.

Paramètres
string$typeThe type of path to add.
mixed$pathThe directory or stream, or an array of either, to search.
Renvoie
void
Depuis
3.0

Références $path, $type, JPath\clean(), DIRECTORY_SEPARATOR, et jimport().

◆ _createFileName()

_createFileName (   $type,
  $parts = array() 
)
protected

Create the filename for a resource

Paramètres
string$typeThe resource type to create the filename for
array$partsAn 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$typeThe type of path to set, typically 'template'.
mixed$pathThe 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()

addHelperPath (   $path)

Adds to the stack of helper script paths in LIFO order.

Paramètres
mixed$pathA directory path or an array of paths.
Renvoie
void
Depuis
3.0

Références $path.

◆ addTemplatePath()

addTemplatePath (   $path)

Adds to the stack of view script paths in LIFO order.

Paramètres
mixed$pathA directory path or an array of paths.
Renvoie
void
Depuis
3.0

Références $path.

◆ assign()

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$keyThe name for the reference in the view.
mixed&$valThe 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()

display (   $tpl = null)

Execute and display a template script.

Paramètres
string$tplThe 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()

escape (   $var)

Escapes a value for output in a view script.

If escaping mechanism is either htmlspecialchars or htmlentities, uses $_encoding setting.

Paramètres
mixed$varThe output to escape.
Renvoie
mixed The escaped value.
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$propertyThe name of the method to call on the model or the property to get
string$defaultThe 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()

getForm ( )

Returns the form object

Renvoie
mixed A object on success, false on failure
Depuis
3.2

Références $form.

◆ getLayout()

getLayout ( )

Get the layout.

Renvoie
string The layout name
Depuis
3.0

◆ getLayoutTemplate()

getLayoutTemplate ( )

Get the layout template.

Renvoie
string The layout template name
Depuis
3.0

◆ getModel()

getModel (   $name = null)

Method to get the model object

Paramètres
string$nameThe name of the model (optional)
Renvoie
mixed object
Depuis
3.0

Références $name, et null.

◆ getName()

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$hlpThe name of the helper source file automatically searches the helper paths and compiles as needed.
Renvoie
void
Depuis
3.0

Références $file, JPath\find(), et jimport().

◆ loadTemplate()

loadTemplate (   $tpl = null)

Load a template file – first look in the templates folder for an override

Paramètres
string$tplThe name of the template source file; automatically searches the template paths and compiles as needed.
Renvoie
string The output of the the template script.
Depuis
3.0
Exceptions

Références $file, $lang, $layout, $template, JPath\find(), jimport(), JPATH_BASE, JPATH_THEMES, et null.

◆ setDocumentTitle()

setDocumentTitle (   $title)

Sets the document title according to Global Configuration options

Paramètres
string$titleThe page title
Renvoie
void
Depuis
3.6

Références $app, $title, et elseif.

◆ setEscape()

setEscape (   $spec)

Sets the _escape() callback.

Paramètres
mixed$specThe callback for _escape() to use.
Renvoie
void
Depuis
3.0
Obsolète:
3.0 Override ::escape() instead.

◆ setLayout()

setLayout (   $layout)

Sets the layout name to use

Paramètres
string$layoutThe layout name or a string in format <template>:<layout file>="">
Renvoie
string Previous value.
Depuis
3.0

Références $layout.

◆ setLayoutExt()

setLayoutExt (   $value)

Allows a different extension for the layout files to be used

Paramètres
string$valueThe 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$modelThe model to add to the view.
boolean$defaultIs this the default model?
Renvoie
The added model.
Depuis
3.0

Références $default, et $name.

Documentation des champs

◆ $_basePath

$_basePath = null
protected

◆ $_charset

$_charset = 'UTF-8'
protected

◆ $_defaultModel

$_defaultModel = null
protected

◆ $_escape

$_escape = 'htmlspecialchars'
protected

◆ $_layout

$_layout = 'default'
protected

◆ $_layoutExt

$_layoutExt = 'php'
protected

◆ $_layoutTemplate

$_layoutTemplate = '_'
protected

◆ $_models

$_models = array()
protected

◆ $_name

$_name = null
protected

◆ $_output

$_output = null
protected

◆ $_path

$_path = array('template' => array(), 'helper' => array())
protected

◆ $_template

$_template = null
protected

◆ $document

$document

La documentation de cette classe a été générée à partir du fichier suivant :