TypoLink: Tiny Helpers To Save The Day #1
Thursday, July 17th, 2008 | Author: Benni
I more and more enjoy the power of TypoScript. Every day, I learn something new. I will
Tip 1: You want to link to the same page, but with JS params etc,
lib.mytext = TEXT
lib.mytext.value = This is a link
lib.mytext.typolink.parameter = {TSFE:id},775 500x600 selflink
lib.mytext.typolink.parameter.insertData = 1
I had to use this idea when having a big site with a lot of microsites where the client is able to clone a microsite without needing to configure any IDs. The typolink.parameter = this,775.. did not work.
Basically, with this project, I had to make sure that no page IDs were hardcoded in TypoScript, so it was easy to create a new site inside TYPO3.
The following example renders a menu based on keywords (there was a requirement about the page titles) instead of a special = directory type of menu.
lib.rightnav = HMENU
lib.rightnav {
special = keywords
special {
value = 1
depth = 2
setKeywords = Contact,Newsletter
keywordsField = title
entryLevel = 0
}
1 = TMENU
1 {
alternativeSortingField = sorting
noBlur = 1
NO.allWrap = <li>|</li>
wrap = <ul class="rightcol_contact">|</ul>
}
}
The next example shows a tt_news to link to the first subpage as the “single page”.
plugin.tt_news.singlePid.cObject = HMENU
plugin.tt_news.singlePid.cObject {
special = directory
special.value.data = TSFE:id
maxItems = 1
includeNotInMenu = 1
1 = TMENU
1 {
NO.doNotLinkIt = 1
NO.stdWrap.field = uid
}
}
I know it’s not big magic and can be solved differently as well, but it just keeps me busy these days ![]()


Wednesday, 27. August 2008
along these same lines, do you know of a way to extract the parameters from a URL, from within Typoscript? I.e. if I link from a page that has a tt_news record displayed, can I pass the news id, etc.. from the URL to the linked page?
Kind regards
Sunday, 21. September 2008
Hey Ant,
to get a parameter from the URL, you should look into the “getData” information in the TSref.
Basically, you could do a
lib.myvar = TEXT
lib.myvar.value = Link to a detailed news page
lib.myvar.typolink.parameter = 13 (or whatever your newsdetail page is)
lib.myvar.typolink.additionalParams = &tt_news[tt_news]={GPvar:tt_news|tt_news}
lib.myvar.typolink.additionalParams.insertData = 1
Well, if you want something even smoother, check out the typoscript. object in TSref. There should be something like typolink.addQueryParams = 1 that automatically adds all $GET parameters from the current URL.
Friday, 9. October 2009
Thanks for that last snippet Benni - it’s been breaking my brain and wearing out Google for a while.
Steve
tt_news to link to the first subpage as the “single page”.