Difference between revisions of "Customising the dynamic page title"

From Joomla! Documentation

m
Line 1: Line 1:
 
To customize the page title to add the site name followed by the document title, edit index.php in the template that you are currently using.  For example, directly after the <head> tag add the following to show "Site Name - Page Name" as the browser's page title:
 
To customize the page title to add the site name followed by the document title, edit index.php in the template that you are currently using.  For example, directly after the <head> tag add the following to show "Site Name - Page Name" as the browser's page title:
  
 +
<source lang="php">
 
  <?php
 
  <?php
 
  $document =& JFactory::getDocument();
 
  $document =& JFactory::getDocument();
 
  $document->setTitle($mainframe->getCfg('sitename') . " - " . $document->title);
 
  $document->setTitle($mainframe->getCfg('sitename') . " - " . $document->title);
 
  ?>
 
  ?>
 
+
</source>
 
[[Category:Tips and tricks]]
 
[[Category:Tips and tricks]]
 
[[Category:Tips and tricks 1.5]]
 
[[Category:Tips and tricks 1.5]]
 +
[[Category:Tutorials]][[Category:Component Development]]

Revision as of 08:03, 20 September 2010

To customize the page title to add the site name followed by the document title, edit index.php in the template that you are currently using. For example, directly after the <head> tag add the following to show "Site Name - Page Name" as the browser's page title:

 <?php
 $document =& JFactory::getDocument();
 $document->setTitle($mainframe->getCfg('sitename') . " - " . $document->title);
 ?>