Christian
Christian

Reputation: 229

Typolink with text

I have a simple text element with a variable src value. What I want to do is to make a typolink around that.

footerlogo = TEXT
footerlogo {
    value = {$footerlogo}
    wrap = <div class="elRightImg"><figure class="imageWr"><img src="|" alt="Footer Logo" style="max-width: 300px;"></figure><div class="clear"></div></div>
}

Output should look like this:

<a href="http://www.example.com" class="myLink"><div class="elRightImg"> ... </div></a>

Upvotes: 0

Views: 969

Answers (1)

Riccardo De Contardi
Riccardo De Contardi

Reputation: 2148

You want to look for the typolink function and its property ATagBeforeWrap :)

footerlogo = TEXT
footerlogo {
  value = {$footerlogo}
  typolink.parameter = http://www.example.com
  typolink.wrap = <div class="elRightImg"><figure class="imageWr"><img src="|" alt="Footer Logo" style="max-width: 300px;"></figure><div class="clear"></div></div>
  typolink.ATagBeforeWrap  = 1 
}

Should work.

Documentation:

https://docs.typo3.org/typo3cms/TyposcriptIn45MinutesTutorial/TypoScriptFunctions/Typolink/Index.html

https://docs.typo3.org/typo3cms/TyposcriptReference/Functions/Typolink/Index.html

Upvotes: 2

Related Questions