Difference between revisions of "JParameter/addElementPath"
From Joomla! Documentation
< API16:JParameter
m (clean up) |
m (preparing for archive only) |
||
Line 4: | Line 4: | ||
− | + | ||
===Syntax=== | ===Syntax=== | ||
Line 50: | Line 50: | ||
− | + | ||
===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=* | ||
format= ,,, | format= ,,, | ||
</dpl> | </dpl> |
Latest revision as of 20:57, 24 March 2017
The "API16" namespace is an archived namespace. This page contains information for a Joomla! version which is no longer supported. It exists only as a historical reference, it will not be improved and its content may be incomplete and/or contain broken links.
Description[edit]
Add a directory where JParameter should search for element types.
Syntax[edit]
addElementPath($path)
Parameter Name | Default Value | Description |
---|---|---|
$path | Directory or directories to search. |
Defined in[edit]
libraries/joomla/html/parameter.php
Importing[edit]
jimport( 'joomla.html.parameter' );
Source Body[edit]
public 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);
}
}
Examples[edit]
Code Examples[edit]