我想显示Joomla菜单项的页面标题(如果已填充)。我尝试过这段代码并没有成功:
https
有什么建议吗?
答案 0 :(得分:0)
我用这种方式解决了自己:
<h1 class="title">
<?php $menu = JFactory::getApplication()->getMenu();
$active = $menu->getActive();
$mydoc = JFactory::getDocument();
$mytitle = $mydoc->getTitle();
$pageHeading = $active->params->get('page_heading');
if($pageHeading != "")
{
echo $pageHeading;
}
else
{
echo $mytitle;
}
?>
</h1>