[Typo3] Alter rendering of tt_content headings
Gwilym Evans
gwilym at redd.com.au
Wed Apr 20 07:30:48 CEST 2005
> > I've been experimenting a little, a reading a lot of the tsref, but
> > just can't get my head around it all yet. What I'm trying
> to achieve
> > is fairly simple in terms of HTML and CSS; div/positioned-based
> > shadowed headings. But it requires a double-up on the
> rendering of the
> > heading text itself.
> >
> > Currently I see the heading text being rendered as (simplified):
> > <div><h1>{Heading Text}</h1></div>
> >
> > I need to somehow alter the TS being included so that
> headings in this
> > template are rendered as such:
> > <div>{Heading Text}<h1>{Heading Text}</h1></div>
> >
> > I can see that it'd be possible, I'm able to alter portions of the
> > included TS libraries to change what's wrapped outside the heading
> > text, but I can't for the life of me figure out how to output the
> > heading text twice.
> >
> > List contributers, as usual your help is always appreciated.
> >
>
>
> You should have a go at the TS By Example document, it's a
> good starter for TS rendering. However, what you need is
> probably something like this [ from memory, so a) sorry if
> there are mistakes, and b) yes it *is* possible to learn TS :D ]
>
>
> lib.myHeader = COA
> lib.myHeader {
> 5 = HTML
> 5.value.data = page:title
> 5.value.wrap = <!-- First div --><div>|</div>
>
> 10 = HTML
> 10.value.data = page:title
> 10.value.wrap = <!-- Second div --><div>|</div> }
>
> lib.stdheader (which is what you'll probably end up modifying
> when dealing with headers) probably uses the TS property
> .insertData, if I remember right, but this is not a major
> difference in the overall approach. For the differences
> between .insertData and the .data stdWrap property, consult
> the TSref section on 'datatypes'.
>
>
> -Christopher
Success, I think! I added this code to my template's TS:
lib.stdheader.10.1 = COA
lib.stdheader.10.1 {
10 = TEXT
10.current = 1
10.fontTag = |
20 = TEXT
20.current = 1
20.insertData = 1
20.fontTag =
<h1{register:headerStyle}{register:headerClass}>|</h1>
}
Recreating the lib.stdheader.10.1 (which is part of the CASE object, as
I only wanted this to effect the first header)
The resulting HTML being:
<div class="csc-header csc-header-n1">Privacy Statement<h1
class="csc-firstHeader">Privacy Statement</h1></div>
Christopher, you kinda nudged me in the right direction, but this was
mainly the result of more experimenting, and close analysis of the
existing static TS for css styled content :)
If anyone sees this as being a complete hack and could recommend a
cleaner way, feel free to jump in!
Cheers,
-Gwilym
More information about the TYPO3-english
mailing list