case

Back
Run example 1Download example 1
Download example 2Run example 2
Case directive is similar with the switch - case in any programming language. Basically you can define several blocks of xml and select the right one to be displayed.

Context: anywhere in //app/client

Remarks:
- the child directive "filter" is the one to place the processing instruction containing the php code that needs to return the name of the block to be displayed; this function has the parameter "$el" which is the DOMNode of the case directive
- You can add as many blocks as needed; if duplicates found all will be displayed;
- If "filter" doesn't return anything or if returns FALSE the "default" block will be displayed;
- If "filter" returns a name of block which doesn't exists, case directive will not display anything; Filter child directive setup: