[TYPO3-english] Check with Typoscript if Templavoila "Link field" is set

Søren Madsen sma at science.au.dk
Fri Oct 8 11:08:29 CEST 2010


> Ok, I see.
> It is still possible, but a bit more tricky.
> You could still insert a lib into that field, but the trickiest problem is that you cannot access the TV field in your normal TS template, so you'll have to insert some TS inside the TV DS (data structure).
> 
> First, you change the readonlinelink-field into a link field.
> 
> Then you open the DS and find the part for this field.
> There you add the typoscript part:
> 
> 			<TypoScript><![CDATA[
> 	10 = TEXT
> 	10.value = {$readonlinelinktext.da}
> 	10.typolink {
> 	     parameter.data = getIndpEnv:TYPO3_REQUEST_URL
> 	     parameter.override.field = field_readonlinelink
> 	     title = {$readonlinelinktext.da}
> 	}
>                    ]]></TypoScript>
> 
> 
> Next, you need to use the trick described here [1] to access your constants inside a TV DS. (It's horendous, sorry) But of course you can also give your editors a sense of flexibility by changing the constant into another TV field. Then you can use field = field_readonlinelinktext
> 
> The only thing you have to take care of is that such changes in the DS get lost when you click 'modify DS/TO' (the button for which TV always warns you) and save. But of course you can always find back your changes in history and redo them.
> 
> It may have been more elegant if you could do this trick in the normal TS templates, but that doesn't work unless you would find a way around this:
> 
> "The scope of the TV fields are kind of tricky, the fields are not available from within your normal TStemplate, actually they are only available from the same level (ie. you can not access fields within a section from a field outside of the section) within the TVDS."
> 
> See [2] for more info
> 
> Anyway, I hope you get hang of it and get it to work.
> Time to go to sleep.
> 
> Cheers,
> Loek
> 
> 
> [1] http://wiki.typo3.org/wiki/TemplaVoila/FCE
> [2] http://wiki.typo3.org/wiki/TemplaVoila

Thanks for the long write up, Loek :)

After trying to wrap my head around the practicalities of your suggestions, I played a bit around with Templavoila, and ended up with something much simpler and maintainable (I think). In Templavoila I simply created an additional "Not mapped" field (field_readonlinelinkfield) - and made this of type "Link field".

In my TS I then just simply do this (with your override trick):

lib.readonlinelink = TEXT
lib.readonlinelink.value = {$readonlinelinktext.da}
lib.readonlinelink.typolink {
         parameter.data = getIndpEnv:TYPO3_REQUEST_URL
         parameter.override.field = field_readonlinelinkfield
         title = {$readonlinelinktext.da}
} 

And it works! Thank you so much for your efforts :)

Regards,
Søren


More information about the TYPO3-english mailing list