API16

JView/loadHelper: Difference between revisions

From Joomla! Documentation

Doxiki (talk | contribs)
New page: ===Description=== Load a helper file <span class="editsection" style="font-size:76%;"> <nowiki>[</nowiki>Edit Descripton<nowiki>]</nowiki> </span> ...
 
m clean up
Line 2: Line 2:
Load a helper file
Load a helper file


<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>[[Description:JView/loadHelper|Edit Descripton]]<nowiki>]</nowiki>
</span>


{{Description:JView/loadHelper}}
 
{{subst:Description:JView/loadHelper}}


===Syntax===
===Syntax===
Line 49: Line 47:
</source>
</source>


<span class="editsection" style="font-size:76%;">
 
<nowiki>[</nowiki>[[SeeAlso:JView/loadHelper|Edit See Also]]<nowiki>]</nowiki>
{{subst:SeeAlso:JView/loadHelper}}
</span>
{{SeeAlso:JView/loadHelper}}


===Examples===
===Examples===

Revision as of 14:38, 24 March 2017

Description

Load a helper file


{{subst:Description:JView/loadHelper}}

Syntax

loadHelper($hlp=null)
Parameter Name Default Value Description
$hlp null The name of the helper source file ... automatically searches the helper paths and compiles as needed.

Returns

boolean Returns true if the file was loaded

Defined in

libraries/joomla/application/component/view.php

Importing

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

Source Body

function loadHelper($hlp = null)
{
        // clean the file name
        $file = preg_replace('/[^A-Z0-9_\.-]/i', '', $hlp);

        // load the template script
        jimport('joomla.filesystem.path');
        $helper = JPath::find($this->_path['helper'], $this->_createFileName('helper', array('name' => $file)));

        if ($helper != false)
        {
                // include the requested template filename in the local scope
                include_once $helper;
        }
}


{{subst:SeeAlso:JView/loadHelper}}

Examples

<CodeExamplesForm />