Blog
12JanCool TypoScript: Alphabetical selector/list
Posted on January 12, 2010 in TypoScript byThe idea for the project was to generate an alphabetical list of products for a tt_products webshop. To make the process list the right products I extended the search a little with a new functionality. However this was not really the challenge! The challenge came with writing the navigation for this. I wanted to do this entirely with TypoScript. And I (we, got a little help from Pim Broens ;-)) did it!

The Code
lib.alphalist 
- lib.alphalist = HTML
- lib.alphalist {
- value = 0-9,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z
- value {
- wrap = <div class="alphalist">|</div>
- split {
- token = ,
- cObjNum = 1
- 1 {
- cObject = HTML
- cObject {
- value {
- typolink {
- parameter = 256
- additionalParams.current = 1
- additionalParams.stdWrap.wrap = &tx_ttproducts_pi1[sword]=|
- ATagParams = class="active"
- ATagParams.if {
- value.data = GPvar:tx_ttproducts_pi1|sword
- equals.current = 1
- }
- }
- current = 1
- insertData = 1
- case = upper
- override = #
- override.if {
- value = 0-9
- equals.current = 1
- }
- }
- }
- }
- }
- }
- }
- }
lib.alphalist = HTML
lib.alphalist {
value = 0-9,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z
value {
wrap = <div class="alphalist">|</div>
split {
token = ,
cObjNum = 1
1 {
cObject = HTML
cObject {
value {
typolink {
parameter = 256
additionalParams.current = 1
additionalParams.stdWrap.wrap = &tx_ttproducts_pi1[sword]=|
ATagParams = class="active"
ATagParams.if {
value.data = GPvar:tx_ttproducts_pi1|sword
equals.current = 1
}
}
current = 1
insertData = 1
case = upper
override = #
override.if {
value = 0-9
equals.current = 1
}
}
}
}
}
}
}
}
What does it do?
It's not so complicated as it seems, we simple create a comma seperated list with all the values we want to have as menu items. Next thing we do is split up and modify the links to our needs (text in uppercase, add an activestate). That's it!



at 15:05
that's it? it's freaking briljant mate!