[TYPO3] Change the title of a page from TS

Ernesto Baschny [cron IT] ernst at cron-it.de
Wed Jan 25 00:29:08 CET 2006


On 23.01.2006 17:43, Jérémy Lecour wrote:

> I use tt_news to manage my news. I also use a 'single_news' page to
> display any news in the SINGLE mode.
>
> My TS code for the title :
> lib.titre_page = TEXT
> lib.titre_page {
> 	data = page:title
> }
>
> It works very fine for all pages. But for my SINGLE page, I'd like to
> have my news page instead of my page real title (it is "Single news"
> and is not very pleasant ;-) )
> 
> I've found in the php code of tt_news that it's making a dynamic title
> substitution with that code :
> 
> // set the title of the single view page to the title of the news record
>  	if ($this->conf['substitutePagetitle']) {
>    $GLOBALS['TSFE']->page['title'] = $row['title'];
>    // set pagetitle for indexed search to news title
>    $GLOBALS['TSFE']->indexedDocTitle = $row['title'];
>  	}
> 
> I'd like to do the same with TS in a template record of in TSconfig of my page.

You can try to make your lib-Object of type COA_INT. This way, it will
be post-poned until after all other scripts on that page have been
called and you can probably access the data = page:title. But this will
probably just work if the page isn't being cached, because if it is,
tt_news won't get called again, thus won't set the page:title. Something
like:

lib.titre_page = COA_INT
lib.titre_page {
	10 = TEXT
	10.data = page:title
}

If that doesn't work, you will have to use some more complex solution to
fetch the title on your own from the tt_news table, like Dmitry suggests.


Cheers,
Ernesto



More information about the TYPO3-english mailing list