[TYPO3] TS: condition for dataWrap in headers

Bert Hiddink hiddink at bendoo.com
Sat Oct 7 20:35:44 CEST 2006


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?

Thanks!

-- 
Bert Hiddink
hiddink at bendoo.nl
BENDOO e-work solutions
http://www.bendoo.nl
Harterinkdijk 8, 7065 AR SINDEREN
The Netherlands
Tel. 0315 244525




More information about the TYPO3-english mailing list