[TYPO3] ELSE in stdWrap->if

JoH info at cybercraft.de
Sun Jun 4 02:02:13 CEST 2006


> I'm quite unsure how to solve the problem when I need to use
> IF-THEN-ELSE statement within TS.
>
> I'd like to have an iFrame's src depending on a GPvar.
>
> temp.iframeContent = TEXT
> temp.iframeContent {
> value = <iframe id="ifMn" name="ifMn" src="{GPvar:iFrameSrc}"
> frameborder="0"></iframe>
> insertData = 1
> }
> this works, yet I need to have a default value in src="" string when
> there is no value for GPvar:iFrameSrc.
> How could I solve this? I'd like to have some default src value.
>
> I have an html template, I parse it using automaketemplate and replace
> something like <iframe id="ifMn" name="ifMn" src="defsrc"
> frameborder="0"></iframe> with the temp.iframeContent.
> It works exept where there is no GPvar:iFrameSrc...
>
> The other concept would be to parse/replace <iframe..> only where the
> GPvar:iFrameSrc is set.

Well - this scenario doesn't require any ELSE since it's a simple IF.
As far as I understood you want to show something or nothing and not
something or something else.
And you can skip insertData by using dataWrap:

temp.iframeContent = TEXT
temp.iframeContent {
    dataWrap = <iframe id="ifMn" name="ifMn" src="{GPvar:iFrameSrc}"
frameborder="0"></iframe>
    if.isTrue.data = GPvar:iFrameSrc
}

That's it ...

Joey

-- 
Wenn man keine Ahnung hat: Einfach mal Fresse halten!
(If you have no clues: simply shut your knob sometimes!)
Dieter Nuhr, German comedian
openBC: http://www.cybercraft.de





More information about the TYPO3-english mailing list