[TYPO3-english] advanced typoscript wrapping needed

JoH asenau info at cybercraft.de
Fri May 1 11:35:47 CEST 2009


> Questions: What's the advantage of using CASE/key instead of the COA/if
> method? Does it change anything in the way the output is produced or is
> it just another way of getting the same result? (Or does the COA method
> not work at all with outerWrap.cObject?)

The advantage of CASE is, that it can check true/false for many different
scenarios at once.
It will take less TS code to write and it will be a bit faster while being
executed, because the checking is done only once, while if will execute
multiple checks in a row.
The drawback is, that you have to write all the different cases, since it
doesn't know "inList" and "or".

In your case you will need i.e.:
G-2G1 < .G1G-2
to check if the usergroups 1 _and_ -2 are set because TYPO3 is not using MM
tables for group fields but CSV (so ORDER BY doesn't work)
G1 < .G-2
to get the wrap for groups 1 _or_ -2

This will double the code for each of them so you lost the advantage of
having less code, but since you can copy it, you still don't have to write
it ;-)

> Having had a quick look ad TSREF it does seem to me that using CASE is a
> way more intended for this kind of issue then using COA.

Well - it depends on the way the stuff you want to check gets assigned.
For fields that can contain CSV values or select boxes with "multiple"
options, both COA and CASE make sense, but when it comes to selectboxes with
lots of single options to choose from, I would definitely go for CASE.
The best example for this scenario is CSS-styled-content itself. CASE is
used to select from the different CType values while rendering the content
elements and AFAIR its used with innerWrap as well, to render the frames
around the elements.

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
Twitter: http://twitter.com/bunnyfield
Xing: http://contact.cybercraft.de
T3 cookbook (2nd edition): http://www.4any1.de
TYPO3 Schulung: http://workshops.eqony.com




More information about the TYPO3-english mailing list