[TYPO3-english] Quick Conditions question

JoH asenau info at cybercraft.de
Mon Aug 16 21:17:29 CEST 2010


> technically [global] and [end] are both conditions that always return
> true and therefore reset earlier conditions.
> 
> See here:
> http://typo3.org/documentation/document-library/core-documentation/doc_core_ts/4.2.0/view/1/2/#id4124614
> 
> Search for "else"
> 
> [End] is usually used to end an [else] branch. Else is a special
> condition returning true if the previous condition returned false.

Well - just to clarify what TSref says: Technically they do exactly the same: Set an "end" to all previous conditions and return to the "global" scope.
So you can safely use "global" to end the "else" condition as well.

BUT: There is still a difference between "end" and "global" because "global" is the only condition that can be used within curly braces.
This comes in handy when you want to do something like in the example.

temp.whatever = TEXT

[condition1]
temp.whatever {
    value = 1 

[condition2]
temp.whatever {
    value = 2

[global]
    wrap = <h2>|</h2>
}

This won't work with "end" unless you rewrite it a bit:

temp.whatever = TEXT
temp.whatever {
    wrap = <h2>|</h2>
}

[condition1]
temp.whatever {
    value = 1 
}

[condition2]
temp.whatever {
    value = 2
}

[end]

HTH

Joey

-- 
Wenn man keine Ahnung hat: Einfach mal Fresse halten!
(If you have no clues: simply shut your gob sometimes!)
Dieter Nuhr, German comedian
Xing: http://contact.cybercraft.de
Twitter: http://twitter.com/bunnyfield
TYPO3 cookbook (2nd edition): http://www.typo3experts.com


More information about the TYPO3-english mailing list