问题描述:

Hi I go to menu page display and enter text into the Browser Page title field but

It does not change the browser page title.

Does anyone have any ideas what could create this issue?

网友答案:

I've had this situation occur most frequently with 3rd party components. Joomla stores these values when you specify them in the menu item, but it's up to the component whether or not they're used. Below is the code I've added to the template overrides. If you don't know how to override template output, you should read How to override the output from the Joomla! core first.

Put this code before any other HTML code in the template override file. It checks to see if you've specified to show the page headings or not, and if so, it will use that, otherwise it will use whatever the menu title is.

<?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; ?>

To see how Joomla does it by default, look at 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;
相关阅读:
Top