Categories > TinyButStrong general >

Different Title on every Html-page

The forum is closed. Please use Stack Overflow for submitting new questions. Use tags: tinybutstrong , opentbs
By: Pirjo Posio
Date: 2004-10-05
Time: 14:25

Different Title on every Html-page

I want to have different html <title>-tag contents on every page, to help search engines to see and index my site and people to find the right page quickly. The site is basically quite similar to the "Sub-templates" example on this site. Now the title is the same on every page, coming from the main template.

I want to use a common header on every page, from sub-template.
But, based on the value of [var.art] I want to change the contents of <title>. The problem is TBS only reads between <body> and </body>, so I can't use conditional title in the header-subtemplate.
How would you solve variable titles on "sub-templates" example?
By: Skrol29
Date: 2004-10-05
Time: 14:46

Re: Different Title on every Html-page

Hi Pirjo,

I can see an issue using TBS 2:

Sub-template:
[onload;tplvars;pagetitle='Search mode']
PHP:
$pagetitle=$TBS->TplVars['pagetitle'];
Main template:
<title>[var.pagetitle]</title>
By: Pirjo Posio
Date: 2004-10-05
Time: 16:57

Re: Different Title on every Html-page

Thanks again for your very quick help, Skrol29!

Since it took me some time to make this work, let's give this advice to others:
- the Sub-template-part must be placed between the body tags of the sub-template.
- the PHP-part must normally be placed between
$TBS->LoadTemplate(...); and
$TBS->Show();