Back to HtmlView class

Method setDocumentTitle

public void
setDocumentTitle
(mixed $title)
Sets the document title according to Global Configuration options
Parameters
  • string $title The page title
Returns
  • void
Since
  • 3.6
Class: HtmlView
Project: Joomla

Method setDocumentTitle - Source code

/**
 * Sets the document title according to Global Configuration options
 *
 * @param   string  $title  The page title
 *
 * @return  void
 *
 * @since   3.6
 */
public function setDocumentTitle($title)
{
    $app = Factory::getApplication();
    // Check for empty title and add site name if param is set
    if (empty($title)) {
        $title = $app->get('sitename');
    } elseif ($app->get('sitename_pagetitles', 0) == 1) {
        $title = Text::sprintf('JPAGETITLE', $app->get('sitename'), $title);
    } elseif ($app->get('sitename_pagetitles', 0) == 2) {
        $title = Text::sprintf('JPAGETITLE', $title, $app->get('sitename'));
    }
    $this->document->setTitle($title);
}