Page 1 of 1

Change title by category name

Posted: 28 Jan 2012, 16:32
by JoniJnm
Hi,

When you are looking a category or section, why no change the document title by the sections/category name? :-)

Re: Change title by category name

Posted: 30 Jan 2012, 23:56
by Jan
Hi, if the page title is empty (parameters of menu link), then the category name is displayed.

Code: Select all

$title = $this->params->get('page_title', '');
		
		if (empty($title) || (isset($title) && $title == '')) {
			$title = $this->item->title; // category title
		}
		
		if (empty($title) || (isset($title) && $title == '')) {
			$title = htmlspecialchars_decode($app->getCfg('sitename'));
		} else if ($app->getCfg('sitename_pagetitles', 0)) {
			$title = JText::sprintf('JPAGETITLE', htmlspecialchars_decode($app->getCfg('sitename')), $title);
		}

		
		$this->document->setTitle($title);
Jan