Blog
Typo3 : Setting the page title tag to the subject of a blog post

TYPO3 is a free Open Source content management system (CMS). In addition to regular CMS functions there are a huge number of extensions. Amongst those, more than one which can be used for blogging. This example shows how to set the title tag of a page to the title of the subject of a blog post when using the WEC Disussion forum extension as a blog. However several techniques are shown here, in pure TypoScript,  which can be adapted and used with different extensions. This example assumes you have already installed the WEC Discussion forum and its working fine.

In the setup section of the extension template of the blog add the following code.

config.noPageTitle = 2
page.headerData.20 = TEXT
page.headerData.20.value = Infohit.net
page.headerData.20.wrap = <title>|
page.headerData.40 = TEXT
page.headerData.40.value = Blog
page.headerData.40.noTrimWrap=| - ||
page.headerData.50 = TEXT
page.headerData.50.value = </title>

[globalVar = HTTP_GET_VARS|tx_wecdiscussion|single>0]
page.headerData.40 = CONTENT
page.headerData.40{
  table=tx_wecdiscussion_post
    # wrap the whole element
   wrap=|
    # the SQL-Query
  select{
    max=1
    selectFields=subject
    pidInList = 22
    andWhere.data = global:HTTP_GET_VARS|tx_wecdiscussion|single
    andWhere.wrap = uid='|'
  }
  renderObj=COA
  renderObj{
    5=TEXT
    5{
      noTrimWrap=| - ||
      field=subject
    }   
  }
}

 

Important: You must update the pidInList for the current page id, the id that the blog entries will have.

Shown in this example:

  • How to rewrite the title tag by first disabling the automatically generated one using: config.NoPageTitle=2
  • How to read http get parameters and conditionally perform actions based on their value
  • How to extract data from SQL tables using CONTENT
  • How to use andWhere which has StdWrap to allow data values as criteria such as http get parameters
  • How to render the retrieved data using renderObj
  • How to wrap text with wraps that contain white space using noTrimWrap
Posted By: admin on Dec 11, 2007 02:52PM Category:Typo3 Add Comment