[TYPO3] TS: condition for dataWrap in headers

Christopher bedlamhotel at gmail.com
Sat Oct 7 21:10:14 CEST 2006


Hi,

On 10/7/06, Bert Hiddink <hiddink at bendoo.com> wrote:
> Hi, Christopher!
>
> Thanks for your reply!
>
> Christopher wrote:
> > Hi,
> >
> > On 10/7/06, Bert Hiddink <hiddink at bendoo.com> wrote:
> >> Hello!
> >>
> >> I have the following TS:
> >>
> >> tt_content.stdWrap.innerWrap.cObject.123.dataWrap = <div
> >> class="tx-contentwrapper_style123"><a
> >> href="index.php?id={field:header_link}" class="bannerlinks"> | </a></div>
> >>
> >> Here, {field:header_link} gives me the id of the page where the header
> >> is linked to. However, the wrap '<a
> >> href="index.php?id={field:header_link}" class="bannerlinks">' is not
> >> correct in case the header is linked to an external page
> >> ("www.something.com"). In the latter case, this should be '<a
> >> href="http://{field:header_link}" target="_new" class="bannerlinks">'
> >>
> >> How could I set a condition in TS which checks the type of link
> >> (internal or external) and then change the wrap accordingly?
> >>
> >> Many thanks in advance as usual!!!
> >
> >
> > The short answer would be 'use typolink,' but can you elaborate on
> > what you're trying to achieve? tt_content.stdWra.innerWrap... is used
> > for wrapping /content elements/ and can be accessed from the 'frame'
> > selector in e.g. text content elements. The problem is that if you
> > wrap a content element in a link (as your code sample tries to do),
> > you create invalid html.
> >
> > What's the actual goal you need to achieve?
>
> I would like to wrap a Header-content-element, where also the subheader
> field has value, with the link which is normally wrapped around the
> Header only.
>
> However, I would like to wrap it around both the Header + subheader.
>
> This is the HTML which is created by the TS mentioned above:
> <div class="tx-contentwrapper_style1"><a href="index.php?id=130"
> class="bannerlinks"><div class="csc-header csc-header-n1"><h1
> class="csc-firstHeader">5 jaar garantie</h1></div><p
> class="csc-subheader csc-subheader-0">Uniek in Nederland!</p></a></div>
>
> In case of an internal link, this is fine but in case of an external
> link, the HTML is not rendered correctly.
>
> Any suggestions?

But again, the HTML is grotesquely invalid ;-)

Why not just link both elements (the only correct way to do what
you're trying...)

-Christopher



More information about the TYPO3-english mailing list