Page 1 of 1

Page title in categories and files

Posted: 18 Oct 2011, 10:25
by gray
I observed that page title in all PD v2.1.1 component is the same - menu title linked to PD. This is not good at all.
So, in
/components/com_phocadownload/views/file/view.html.php
if found this piece of code

Code: Select all

		$title = $this->params->get('page_title', '');
		if (empty($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);

		if (empty($title)) {
			$title = $this->item->title;
		}
		$this->document->setTitle($title);
First question I have, why $this->document->setTitle($title); is set 2 times. I simply disabled it the first line.

Second, I could not figure out the source of the title, and just set the second $this->document->setTitle($title); to

Code: Select all

$this->document->setTitle($file->title);
The same refers to category titles set in /components/com_phocadownload/views/category/view.html.php

Re: Page title in categories and files

Posted: 19 Oct 2011, 22:42
by Jan
Hi, the title can be set in menu link parameters.

$this->document->setTitle($title); 2x - will be fixed in next release.

Jan

Re: Page title in categories and files

Posted: 04 Nov 2011, 18:24
by gray
I updated to PD 2.1.3, but the problem remains. I set page title in the menu manage - it shows on the browser's title. It's OK, but the issue is that it's the same for all pages.
Moreover, if I try to use this code (assume the title is empty)

Code: Select all

if (empty($title) || (isset($title) && $title == '')) {
  $title = $this->item->title;
}
I got error Notice: Undefined property: PhocaDownloadViewFile::$item, so $title = $this->item->title; is not working at all.

Finally I change the above piece of code to

Code: Select all

$title = $file->title . ' | ' . $category->title . ' | ' . $title;
This includes file's name first, then category title, and adds the menu title (or custom title set in menu's options).

The same I did with category view, simple replacing the if block with

Code: Select all

$title = $category->title . ' | ' . $title;

Re: Page title in categories and files

Posted: 17 Nov 2011, 19:11
by Jan
Hi, thank you for this info.

Jan

Re: Page title in categories and files

Posted: 18 Jan 2012, 13:15
by laita
Hi, need your help with similar problem.
Is there something that can be done with PD 1.3.9 to change page title in the browser?