1

I'm using Joomla 3.4.8, and I have all of my pages linked to menu items. I can't figure out how to get the menu item title to show in the tag of the page, rather than only the article title.

For eg. My Menu item title is 'test', when i press the button it shows test but in that menu item there are many articles. when i click on the article in the test page. It only shows the article name and not the menu item. What i want is that it shows the article name + the menu item.

I know that I can change each 'Browser Page Title' setting for each menu item and individually override the menu item title. But I'm worried this will create confusion in the future when trying to update page titles.

4

Here is the simple answer for you.

<?php

$menu = JSite::getMenu()->getActive();

//SET THE PAGE TITLE
$doc= JFactory::getDocument();
$doc->setTitle($menu->title.' - '.$this->item->title);

?>

On your front end you should now have a title formatted as Menu Title - Article Title

  • 1
    I updated my code. Glad it works for you. Please delete your previous comments as well so it doesn't clutter up the JSE. Have a good day and please be sure to mark this answer as accepted. – Terry Carter Mar 12 '16 at 17:16
  • Thank you so much again sir. you have been to a great help. and I appreciate your job around here. :) – Peter Mar 12 '16 at 20:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.