API15

Difference between revisions of "JView/assign"

From Joomla! Documentation

< API15:JView
(New page: ===Description=== Assigns variables to the view script via differing strategies. <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>[[Description:JView/assign|Edit De...)
 
m (preparing for archive only)
 
(One intermediate revision by the same user not shown)
Line 3: Line 3:
  
 
<span class="editsection" style="font-size:76%;">
 
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[Description:JView/assign|Edit Descripton]]<nowiki>]</nowiki>
+
<nowiki>[<! removed edit link to red link >]</nowiki>
 
</span>
 
</span>
  
{{Description:JView/assign}}
+
<! removed transcluded page call, red link never existed >
  
 
===Syntax===
 
===Syntax===
Line 69: Line 69:
  
 
<span class="editsection" style="font-size:76%;">
 
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[SeeAlso:JView/assign|Edit See Also]]<nowiki>]</nowiki>
+
<nowiki>[<! removed edit link to red link >]</nowiki>
 
</span>
 
</span>
{{SeeAlso:JView/assign}}
+
<! removed transcluded page call, red link never existed >
  
 
===Examples===
 
===Examples===
<CodeExamplesForm />
+
=== Code Examples ===
 
<dpl>
 
<dpl>
 
  noresultsheader=\n
 
  noresultsheader=\n
 
  category=assign
 
  category=assign
 
  category=JView
 
  category=JView
  category=CodeExample
+
  namespace=CodeExample
 
  category=MethodExample
 
  category=MethodExample
 
  include=*
 
  include=*
 
  format= ,,,
 
  format= ,,,
 
</dpl>
 
</dpl>
 +
[[Category:Archived pages API15]]

Latest revision as of 20:16, 24 March 2017

The "API15" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.

Description[edit]

Assigns variables to the view script via differing strategies.

[<! removed edit link to red link >]

<! removed transcluded page call, red link never existed >

Syntax[edit]

assign()


Returns[edit]

bool True on success, false on failure.

Defined in[edit]

libraries/joomla/application/component/view.php

Importing[edit]

jimport( 'joomla.application.component.view' );

Source Body[edit]

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[edit]

Code Examples[edit]