【发布时间】:2014-12-04 16:50:48
【问题描述】:
您好,我进入菜单页面显示并在浏览器页面标题字段中输入文本,但是
它不会改变浏览器页面的标题。
有没有人知道什么会造成这个问题?
【问题讨论】:
-
请在Joomla Stack Exchange提出您的问题
标签: joomla
您好,我进入菜单页面显示并在浏览器页面标题字段中输入文本,但是
它不会改变浏览器页面的标题。
有没有人知道什么会造成这个问题?
【问题讨论】:
标签: joomla
这种情况最常发生在第 3 方组件中。当您在菜单项中指定这些值时,Joomla 会存储这些值,但是否使用它们取决于组件。下面是我添加到模板覆盖的代码。如果你不知道如何覆盖模板输出,你应该先阅读How to override the output from the Joomla! core。
将此代码放在模板覆盖文件中的任何其他 HTML 代码之前。它会检查您是否指定显示页面标题,如果是,它将使用它,否则它将使用菜单标题。
<?php if ($this->params->get('show_page_heading',1)) : ?>
<h1><?php echo $this->params->get('page_heading') ? $this->params->get('page_heading') : JFactory::getApplication()->getMenu()->getActive()->title; ?></h1>
<?php endif; ?>
要了解 Joomla 默认是如何做到的,请查看 components\com_content\views\article\tmpl\default.php
<div class="item-page<?php echo $this->pageclass_sfx?>">
<?php if ($this->params->get('show_page_heading', 1)) : ?>
<div class="page-header">
<h1> <?php echo $this->escape($this->params->get('page_heading')); ?> </h1>
</div>
<?php endif;
【讨论】: