Setting a GET Parameter as a Variable in Typoscript
Recently I had a problem that, in spite of many “support leads” on other sites, was hard to figure out. All I wanted to do was reference as GET parameter in a URL as a variable in Typoscript. After many failed attempts, I found a solution to my problem. So, for future reference, and for all others who may be struggling with this problem, here is a slice of example code that solved my problem:
lib.featured < plugin.tt_news lib.featured { code > code = LIST pid_list > pid_list = 10064 catImageMode = 1 catTextMode = 0 categorySelection = TEXT categorySelection.data = GPvar : cat categoryMode = 1 limit = 1 singlePid = 1729 general_stdWrap.crop = 300 |<img src="fileadmin/templates/news/images/featured.png" class="tag" /> ... | 1 templateFile = fileadmin/templates/ext_templates/tt_news_student_life_feature.html }
What I was trying to accomplish was changing news categories on a single page so that different news would display on a page simply by changing a category number. The two lines you should pay attention to above are:
categorySelection = TEXT categorySelection.data = GPvar : cat
Here, the code “GPvar : cat” will get the value of a GET parameter named “cat” out of a URL like this:
http://www.example.com/index.php?id=7565&cat=19
What I discovered was that, in order to use the GET parameter in Typoscript, I needed to type the variable in Typoscript before it could be referenced. Hence the “categorySelection = TEXT” code.


