菜单

How to set page title in USER_INT extension

2010年08月3日 - typoscript

There are many discussions at forums concerning setting the title of the page from the USER_INT plug level. The problem is that the USER_INT type extensions are generated every time the page is refreshed after TYPO3 generates the headline of the page containing a tag title. A good example may be the mm_forum, where each thread in a standard installation has the same title, and not the name of the topic as we wish for.

The solution is quite simple :) We should add the following code to the code of our USER_INT plug:

//set page title
  1. $GLOBALS[‘TSFE’]->additionalHeaderData[‘title’] = ‘<title>’.htmlspecialchars($title).’ – my page</title>’;

Then in the Typoscript template for the single view page we should add such TS code:

//set page title
  1. config.noPageTitle = 2

If we look into the cache_pages table now and find the cached single view page contents, we will see that the following marker appears in the headline of the page
<!–HD_d484cf6fcedc0c064492df3e9219ffd1–>
Instead, the USER_INT plug will now generate our title.

发表评论

电子邮件地址不会被公开。 必填项已用*标注