2016-08-19 17 views
0

我想获得一个数组,其中包含所有当前模板职位名称,如相应的templateDetails.xml中所列。从Joomla模板获取一个包含所有职位名称的数组

我想:

$this->params->get('positions') 

但没有奏效。

该代码将被调用或插入到/templates/mytemplate/index.php文件中。

我在模块参数页面看到一个选择,显示所有已安装模板的所有可用位置,也许它提供了如何实现它的线索。

回答

1

最近我编辑了joomla文档https://docs.joomla.org/JFactory/getXMLParser的帖子。几乎没有一周,因为它很久没有更新。在给予templateDetails.xml位置后,您可以通过这种方式获取模板位置。

$xmlfile = 'templates/protostar/templateDetails.xml';//Change to your template 
$xml = JFactory::getXML($xmlfile); 
//The position array is this `$xml->positions->position` 
foreach ($xml->positions->position as $position) { 
    echo $position . "<br />"; 
} 
相关问题