Archive for December 2007
When using Google Analytics, in order to get a real picture of what is going on on your site, its very important to disable the counting of hits from your own browser. The Google Analytics FAQ documents how to do this by setting a cookie on a hidden web page by adding onload to the body tag on the page. http://www.google.com/support/analytics/bin/answer.py?hl=en&answer=55481 However its not immediately obvious how to do this in TYPO3, in fact while its not obvious it is still rather easy, and can be done in just 2 steps using a custom body tag.
- Create a regular page and hide it in the menu. Add a piece of plain text to it
- Create an extention template for the page, and in the Setup section add one the following pieces of code:
If you are using the old urchin.js code in your pagepage.bodyTag = <body onload="javascript:__utmSetVar('no_report')">If you are using the new ga.js in your pagepage.bodyTag = <body onload="javascript:pageTracker._setVar('no_report')"> - Your done! Just visit the page you created and then set up the custom filter as per the Google documentation and your own hits will no longer be counted
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