[Typo3] Last word in header different color
Torsten Schrade
schrade at lineara.de
Thu Jun 30 07:22:24 CEST 2005
Rudy Gnodde wrote:
> Hello,
>
> I am trying to get something working. What I have is a list of all the headers of all content on a page. I did this with the following TypoScript code:>
> But what I want now is to give the last word (so everything after the last space) a different color. I've been looking into the split option, but so far no luck. Does anybody know if this can be done with TypoScript and how?
>
Hi Rudy,
the following TS does what you want:
lib.headers = CONTENT
lib.headers.wrap = <ul> | </ul>
lib.headers {
table = tt_content
select {
pidInList = this
orderBy = sorting desc
where = header!=''
}
renderObj = COA
renderObj {
wrap = <li> | </li>
10 = TEXT
10.field = uid
10.wrap = |
20 = TEXT
20.field = header
20.split {
token.char = 32
cObjNum = 1
1.current = 1
wrap = | |*|| |*|<span style="color:
blue">| </span>
}
}
}
All words in the header are split with token.char 32 (space). Therefore
you have to reinsert the spaces between words with The option
split does that for the first value, then repeats it in the middle value
till it reaches the last element in the split array (=last word) where
an additional span is wraped around that you can style to a color of
your liking.
Cheers, Torsten
More information about the TYPO3-english
mailing list