API15

JView/ construct: Difference between revisions

From Joomla! Documentation

Doxiki (talk | contribs)
No edit summary
m removing red link to edit, no existant pages
Line 3: Line 3:


<span class="editsection" style="font-size:76%;">
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[Description:JView/__construct|Edit Descripton]]<nowiki>]</nowiki>
<nowiki>[<! removed edit link to red link >]</nowiki>
</span>
</span>


{{Description:JView/__construct}}
<! removed transcluded page call, red link never existed >


===Syntax===
===Syntax===
Line 86: Line 86:


<span class="editsection" style="font-size:76%;">
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[SeeAlso:JView/__construct|Edit See Also]]<nowiki>]</nowiki>
<nowiki>[<! removed edit link to red link >]</nowiki>
</span>
</span>
{{SeeAlso:JView/__construct}}
<! removed transcluded page call, red link never existed >


===Examples===
===Examples===
Line 101: Line 101:
  format= ,,,
  format= ,,,
</dpl>
</dpl>
[[Category:Archived pages API15]]

Revision as of 18:58, 12 May 2013

Description

Constructor

[<! removed edit link to red link >]

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

Syntax

__construct($config=array())
Parameter Name Default Value Description
$config array()

Defined in

libraries/joomla/application/component/view.php

Importing

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

Source Body

function __construct($config = array())
{
        //set the view name
        if (empty( $this->_name ))
        {
                if (array_key_exists('name', $config))  {
                        $this->_name = $config['name'];
                } else {
                        $this->_name = $this->getName();
                }
        }

         // set the charset (used by the variable escaping functions)
if (array_key_exists('charset', $config)) {
    $this->_charset = $config['charset'];
}

         // user-defined escaping callback
if (array_key_exists('escape', $config)) {
    $this->setEscape($config['escape']);
}

        // Set a base path for use by the view
        if (array_key_exists('base_path', $config)) {
                $this->_basePath        = $config['base_path'];
        } else {
                $this->_basePath        = JPATH_COMPONENT;
        }

        // set the default template search path
        if (array_key_exists('template_path', $config)) {
                // user-defined dirs
                $this->_setPath('template', $config['template_path']);
        } else {
                $this->_setPath('template', $this->_basePath.DS.'views'.DS.$this->getName().DS.'tmpl');
        }

        // set the default helper search path
        if (array_key_exists('helper_path', $config)) {
                // user-defined dirs
                $this->_setPath('helper', $config['helper_path']);
        } else {
                $this->_setPath('helper', $this->_basePath.DS.'helpers');
        }

        // set the layout
        if (array_key_exists('layout', $config)) {
                $this->setLayout($config['layout']);
        } else {
                $this->setLayout('default');
        }

        $this->baseurl = JURI::base(true);
}

[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >

Examples

<CodeExamplesForm />