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.

Return Value

at line 292

boolean
assignRef(string $key, mixed $val)

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->ref = &$var1;

Parameters

string

$key

The name for the reference in the view.

mixed

$val

&$val The referenced variable.

Return Value

boolean

True on success, false on failure.

at line 312

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.

Parameters

mixed

$var

The output to escape.

Return Value

mixed

The escaped value.

at line 366

mixed
getModel(string $name = null)

Method to get the model object

Parameters

string

$name

The name of the model (optional)

Return Value

mixed

JModel object

at line 379

string
getLayout()

Get the layout.

Return Value

string

The layout name

at line 389

string
getLayoutTemplate()

Get the layout template.

Return Value

string

The layout template name

at line 403

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

Return Value

string

The name of the model

at line 435

object
setModel(object $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.

Parameters

object

$model

The model to add to the view.

boolean

$default

Is this the default model?

Return Value

object

The added model

at line 454

string
setLayout(string $layout)

Sets the layout name to use

Parameters

string

$layout

The layout name or a string in format :

Return Value

string

Previous value

at line 479

string
setLayoutExt(string $value)

Allows a different extension for the layout files to be used

Parameters

string

$value

The extension

Return Value

string

Previous value

at line 493

setEscape(mixed $spec)

Sets the _escape() callback.

Parameters

mixed

$spec

The callback for _escape() to use.

at line 504

void
addTemplatePath(string|array $path)

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

Parameters

string|array

$path

The directory (-ies) to add.

Return Value

void

at line 515

void
addHelperPath(string|array $path)

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

Parameters

string|array

$path

The directory (-ies) to add.

Return Value

void

at line 527

string
loadTemplate(string $tpl = null)

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

Parameters

string

$tpl

The name of the template source file ...
automatically searches the template paths and compiles as needed.

Return Value

string

The output of the the template script.

at line 610

boolean
loadHelper(string $hlp = null)

Load a helper file

Parameters

string

$hlp

The name of the helper source file ...
automatically searches the helper paths and compiles as needed.