Difference between revisions of "JApplicationHelper/getPath"
From Joomla! Documentation
< API16:JApplicationHelper
(New page: ===Description===
Get a path
<span class="editsection" style="font-size:76%;">
<nowiki>[</nowiki>Edit Descripton<nowiki>]</nowiki>
</span>
...) |
m (preparing for archive only) |
||
(2 intermediate revisions by the same user not shown) | |||
Line 2: | Line 2: | ||
Get a path | Get a path | ||
− | |||
− | |||
− | |||
− | + | ||
+ | <! removed transcluded page call, red link never existed > | ||
===Syntax=== | ===Syntax=== | ||
Line 142: | Line 140: | ||
</source> | </source> | ||
− | + | ||
− | + | <! removed transcluded page call, red link never existed > | |
− | < | ||
− | |||
===Examples=== | ===Examples=== | ||
− | + | === Code Examples === | |
<dpl> | <dpl> | ||
noresultsheader=\n | noresultsheader=\n | ||
category=getPath | category=getPath | ||
category=JApplicationHelper | category=JApplicationHelper | ||
− | + | namespace=CodeExample | |
category=MethodExample | category=MethodExample | ||
include=* | include=* | ||
format= ,,, | format= ,,, | ||
</dpl> | </dpl> | ||
+ | [[Category:Archived pages API16]] |
Latest revision as of 20:18, 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]
Get a path
<! removed transcluded page call, red link never existed >
Syntax[edit]
static getPath($varname, $user_option=null)
Parameter Name | Default Value | Description |
---|---|---|
$varname | $varname | |
$user_option | null | $user_option |
Returns[edit]
string The requested path
Defined in[edit]
libraries/joomla/application/helper.php
Importing[edit]
jimport( 'joomla.application.helper' );
Source Body[edit]
public static function getPath($varname, $user_option=null)
{
// check needed for handling of custom/new module xml file loading
$check = (($varname == 'mod0_xml') || ($varname == 'mod1_xml'));
if (!$user_option && !$check) {
$user_option = JRequest::getCmd('option');
} else {
$user_option = JFilterInput::getInstance()->clean($user_option, 'path');
}
$result = null;
$name = substr($user_option, 4);
switch ($varname) {
case 'front':
$result = self::_checkPath(DS.'components'.DS. $user_option .DS. $name .'.php', 0);
break;
case 'html':
case 'front_html':
if (!($result = self::_checkPath(DS.'templates'.DS. JApplication::getTemplate() .DS.'components'.DS. $name .'.html.php', 0))) {
$result = self::_checkPath(DS.'components'.DS. $user_option .DS. $name .'.html.php', 0);
}
break;
case 'toolbar':
$result = self::_checkPath(DS.'components'.DS. $user_option .DS.'toolbar.'. $name .'.php', -1);
break;
case 'toolbar_html':
$result = self::_checkPath(DS.'components'.DS. $user_option .DS.'toolbar.'. $name .'.html.php', -1);
break;
case 'toolbar_default':
case 'toolbar_front':
$result = self::_checkPath(DS.'includes'.DS.'HTML_toolbar.php', 0);
break;
case 'admin':
$path = DS.'components'.DS. $user_option .DS.'admin.'. $name .'.php';
$result = self::_checkPath($path, -1);
if ($result == null) {
$path = DS.'components'.DS. $user_option .DS. $name .'.php';
$result = self::_checkPath($path, -1);
}
break;
case 'admin_html':
$path = DS.'components'.DS. $user_option .DS.'admin.'. $name .'.html.php';
$result = self::_checkPath($path, -1);
break;
case 'admin_functions':
$path = DS.'components'.DS. $user_option .DS. $name .'.functions.php';
$result = self::_checkPath($path, -1);
break;
case 'class':
if (!($result = self::_checkPath(DS.'components'.DS. $user_option .DS. $name .'.class.php'))) {
$result = self::_checkPath(DS.'includes'.DS. $name .'.php');
}
break;
case 'helper':
$path = DS.'components'.DS. $user_option .DS. $name .'.helper.php';
$result = self::_checkPath($path);
break;
case 'com_xml':
$path = DS.'components'.DS. $user_option .DS. $name .'.xml';
$result = self::_checkPath($path, 1);
break;
case 'mod0_xml':
$path = DS.'modules'.DS. $user_option .DS. $user_option. '.xml';
$result = self::_checkPath($path);
break;
case 'mod1_xml':
// admin modules
$path = DS.'modules'.DS. $user_option .DS. $user_option. '.xml';
$result = self::_checkPath($path, -1);
break;
case 'plg_xml':
// Site plugins
$j15path = DS.'plugins'.DS. $user_option .'.xml';
$parts = explode(DS, $user_option);
$j16path = DS.'plugins'.DS. $user_option.DS.$parts[1].'.xml';
$j15 = self::_checkPath($j15path, 0);
$j16 = self::_checkPath( $j16path, 0);
// return 1.6 if working otherwise default to whatever 1.5 gives us
$result = $j16 ? $j16 : $j15;
break;
case 'menu_xml':
$path = DS.'components'.DS.'com_menus'.DS. $user_option .DS. $user_option .'.xml';
$result = self::_checkPath($path, -1);
break;
}
return $result;
}
<! removed transcluded page call, red link never existed >
Examples[edit]
Code Examples[edit]