JOOMLA FICTION LAB
(2 votes)

How to get the current page title in Joomla

Wednesday, 19 October 2011 13:52
In Joomla there is a very fast way to get the Page Title using the Joomla API and the method JDocument::getTitle.

You can visit this link for a more detailed description of the JDocument::getTitle method.

Now you can take this one step further and modify the title by using the method JFactory::getConfig and the function setTitle.

Get Page Title

$doc = JFactory::getDocument();
$page_title = $doc->getTitle();

Modify Page Title

$con =& JFactory::getConfig();
$sitename = $con->getValue('config.sitename');
$doc->setTitle($page_title.' - '.$sitename);




Add comment


Security code
Refresh