API15:JView/assign
From Joomla! Documentation
This Namespace has been archived - Please Do Not Edit or Create Pages in this namespace. Pages contain information for a Joomla! version which is no longer supported. It exists only as a historical reference, will not be improved and its content may be incomplete.
Contents |
Description
Assigns variables to the view script via differing strategies.
[<! removed edit link to red link >]
<! removed transcluded page call, red link never existed >
Syntax
assign()
Returns
bool True on success, false on failure.
Defined in
libraries/joomla/application/component/view.php
Importing
jimport( 'joomla.application.component.view' );
Source Body
function assign() { // get the arguments; there may be 1 or 2. $arg0 = @func_get_arg(0); $arg1 = @func_get_arg(1); // assign by object if (is_object($arg0)) { // assign public properties foreach (get_object_vars($arg0) as $key => $val) { if (substr($key, 0, 1) != '_') { $this->$key = $val; } } return true; } // assign by associative array if (is_array($arg0)) { foreach ($arg0 as $key => $val) { if (substr($key, 0, 1) != '_') { $this->$key = $val; } } return true; } // assign by string name and mixed value. // we use array_key_exists() instead of isset() becuase isset() // fails if the value is set to null. if (is_string($arg0) && substr($arg0, 0, 1) != '_' && func_num_args() > 1) { $this->$arg0 = $arg1; return true; } // $arg0 was not object, array, or string. return false; }
[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >
Examples
<CodeExamplesForm />
