| Flexy If Condition [message #1169] |
Tue, 21 August 2007 14:39  |
pjsb01 Messages: 19 Registered: January 1970 |
Junior Member |
|
|
Hi,
is there anywhere besides the pear manual a overview over flexy functions/syntax?
i know there is there is the possibility to use {if:test}...{else:}...{end:}
Can i use a switch? Is there a possibility other variables besides bool s.th. like {if:test==lala}...{else:}...{end:}
greetz
|
|
|
| Re: Flexy If Condition [message #1170 is a reply to message #1169 ] |
Tue, 21 August 2007 20:56   |
biGGs Messages: 46 Registered: January 1970 |
Member |
|
|
Greetings!
Well, Flexy is a very simple template language, so many things you know from programming languages like PHP are missing. Have a look at the API docs of the PEAR module. (pear.php.net) Not the best docu, but all defined tags are listed.
Boolean checks are possible, using "!" for checking if something is false is also possible. If you want to do a equal check, you have to use the defined function in the SGL_Output class. An isEqual() function is given - so your check would be:
{if:isEqual(var1,var2)}
{end:}
If it's not a variable and not a positive number you have to prefix and postfix it like a string. So you use:
{if:isEqual(var1,#-1#)}
{end:}
Looping is done like this:
{foreach:aArray,key,value}
{end:}
You can use loops and conditions within HTML tags, so you save yourself the {end:} writing. Have a look at the templates coming with Seagull, you will find a lot examples for everything Flexy is offering.
Cheers
Phil
|
|
|
| Re: Flexy If Condition [message #1511 is a reply to message #1170 ] |
Mon, 04 January 2010 05:44  |
|
Only One word to characterize such a great post “WOW” that was a very interesting read
AcneZine
[Updated on: Mon, 04 January 2010 05:45] by Moderator
|
|
|