[TYPO3-english] Using IF in TypoScript

Peter Klein peter at umloud.dk
Fri Jul 10 15:08:39 CEST 2009


Hi Redvald.

ALWAYS look in TSRef. If you look at the IMAGE object, then there's no
"if" property inside the "file"property, where you have placed your
"if".

Looking at TSRef for the IMAGE object, you can see that there's an
"if" property on the toplevel of the object.

So you should be able to do something like:

lib.image.if.isTrue.data = {page:media}


Note that you need to use "data" and not "field" if you try accessing
vars outside the local scope.

--
Peter Klein


On Fri, 10 Jul 2009 13:56:02 +0200, Redvald Hjulstad
<redvald at hjulstad.no> wrote:

>I have a script that creates a image from the pageheader. But I would 
>like it to only generate the image if there is a image on the 
>mediafield. As it is now it is generating a transparent image if there 
>is noe image in the mediafield.
>
>Here is my TS:
>lib.image = IMAGE
>lib.image {
>
>	file = GIFBUILDER
>	file {
>		if.isTrue.field = {page:media}
>		XY = 569,419
>		format = png
>		backColor = #e5e5e5
>		transparentColor = #e5e5e5
>		transparentBackground = 1
>		10 = IMAGE
>		10 {
>        	file.width = 550c
>        	file.height = 400c
>		file.import=uploads/media/	
>		file.import.data = levelmedia: -1,slide
>		mask = fileadmin/templates/main/images/mask.png
>			
>		}
>		
>				
>		}
>	}
>
>I have tried to use the if.isTrue.field several places in the script, 
>but can not figure out how ot get it right.
>
>red


More information about the TYPO3-english mailing list