API15

JView/loadHelper: Difference between revisions

From Joomla! Documentation

m removing red link to edit, no existant pages
m preparing for archive only
 
Line 55: Line 55:


===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=*

Latest revision as of 01:16, 25 March 2017

Description

Load a helper file

[<! removed edit link to red link >]

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

Syntax

loadHelper($hlp=null)
Parameter Name Default Value Description
$hlp null $tpl 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;
        }
}

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

Examples

Code Examples