By Sebastiaan de Jonge, published on Tuesday, January 12, 2010 at 21:23

The 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!

lib.alphalist = TEXT
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 = &#35;
              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!

Comments

Pim Broens
Pim Broens - Friday, January 15, 2010 at 15:05

that's it? it's freaking briljant mate!

Nick
Nick - Tuesday, May 5, 2015 at 20:41

Great TypoScript-snippet, thx 4 that.4 TYPO3 >6 use TEXT instead HTML

Sebastiaan de Jonge
Sebastiaan de Jonge - Monday, September 19, 2016 at 08:13

Thanks Nick, I've updated the snippet. The HTML content object has indeed been deprecated for some time already. 🙂