JParameter/addElementPath: Difference between revisions
From Joomla! Documentation
m removing red link to edit, no existant pages |
m preparing for archive only |
||
| Line 60: | Line 60: | ||
===Examples=== | ===Examples=== | ||
=== Code Examples === | |||
<dpl> | <dpl> | ||
noresultsheader=\n | noresultsheader=\n | ||
category=addElementPath | category=addElementPath | ||
category=JParameter | category=JParameter | ||
namespace=CodeExample | |||
category=MethodExample | category=MethodExample | ||
include=* | include=* | ||
Latest revision as of 01:01, 25 March 2017
Description
Add a directory where JParameter should search for element types
[<! removed edit link to red link >]
<! removed transcluded page call, red link never existed >
Syntax
addElementPath($path)
| Parameter Name | Default Value | Description |
|---|---|---|
| $path | directory or directories to search. |
Defined in
libraries/joomla/html/parameter.php
Importing
jimport( 'joomla.html.parameter' );
Source Body
function addElementPath( $path )
{
// just force path to array
settype( $path, 'array' );
// loop through the path directories
foreach ( $path as $dir )
{
// no surrounding spaces allowed!
$dir = trim( $dir );
// add trailing separators as needed
if ( substr( $dir, -1 ) != DIRECTORY_SEPARATOR ) {
// directory
$dir .= DIRECTORY_SEPARATOR;
}
// add to the top of the search dirs
array_unshift( $this->_elementPath, $dir );
}
}
[<! removed edit link to red link >] <! removed transcluded page call, red link never existed >
Examples
Code Examples