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 preparing for archive only
 
(One intermediate revision by the same user not shown)
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}}
 
 


===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>
 
</span>
{{SeeAlso:JView/loadHelper}}


===Examples===
===Examples===
<CodeExamplesForm />
=== Code Examples ===
<dpl>
<dpl>
  noresultsheader=\n
  noresultsheader=\n
  category=loadHelper
  category=loadHelper
  category=JView
  category=JView
  category=CodeExample
  namespace=CodeExample
  category=MethodExample
  category=MethodExample
  include=*
  include=*
  format= ,,,
  format= ,,,
</dpl>
</dpl>

Latest revision as of 02:17, 25 March 2017

Description

Load a helper file



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;
        }
}



Examples

Code Examples