[prev in list] [next in list] [prev in thread] [next in thread] 

List:       smarty-dev
Subject:    Re: [SMARTY-DEV] Re: cvs commits, passes smoke tests
From:       Monte Ohrt <monte () ispi ! net>
Date:       2002-12-23 22:54:40
[Download RAW message or body]

FYI in the latest CVS, nested function calls work in IF statements.

On Fri, 2002-12-20 at 01:41, André Rabold wrote:
> Sorry for reporting errors ;-)
> 
> {if strlen(trim($var)) > 4}
>   ...
> {/if}
> 
> Doesn't work anymore after your commit. It seems you cannot use functions as
> parameter for functions anymore. The compiled script has syntax (!!) errors.
> 
> Does {$foo[$index]->getVar("bar")} and
> {$foo[sectionindex.index_next]->getVar("bar")} work? Haven't tested it yet
> but I really need this and haven't found any comment on this in your
> posting.
> 
> Have fun,
> André
> 
> 
> 
> "Monte Ohrt" <monte@ispi.net> schrieb im Newsbeitrag
> news:1040343207.16659.144.camel@lena.ispi.prv...
> > Ok, I've had my fill of regex work for awhile, that is enough to drive
> > one mad :-)
> >
> > the latest commit passes my smoke tests, which you can get here:
> >
> > http://www.phpinsider.com/temp/smarty_smoketest.tar.gz
> >
> > I tried to cover as much as I could, but I'm sure there is more that
> > could be added.
> >
> > The regular expressions are cleaned up and cascade nicely, so a lot of
> > syntax that didn't previously work now does. It is _way_ more managable
> > now, I don't get such headaches looking at them :-) I tried strange
> > stuff like passing objects as parameters to modifiers and it works fine.
> > About the only thing you can't do is pass an object as a parameter to an
> > object. That is only be design, it's possible but I didn't see a reason
> > to support it. You can call objects in objects just fine though, such as
> > ($foo->bar->foobar('blah'))
> >
> > Here are some examples from the smoke test, and they work:
> >
> > {$foo}
> > {$foo|upper}
> > {$foo|upper|spacify}
> > {$foo|spacify:"^^"}
> > {$foo|@count}
> > {$foo|default:"no"}
> > {$foo|truncate:6:"...":true}
> >
> > {$afoo.one}
> > {$afoo.two}
> > {$afoo.one|upper}
> > {$afoo.one|upper|spacify}
> > {$afoo.one|spacify:"^^"}
> > {$afoo.one|@count}
> > {$afoo.one|default:"no"}
> > {$afoo.one|truncate:6:"...":true}
> > {$afoo.$bar}
> >
> > {#foo#}
> > {#foo#|upper}
> > {#foo#|upper|spacify}
> > {#foo#|spacify:"^^"}
> > {#foo#|@count}
> > {#foo#|default:"no"}
> > {#foo#|truncate:6:"...":true}
> >
> >
> > {#foo#}
> > {#foo#|upper}
> > {#foo#|upper|spacify}
> > {#foo#|spacify:"^^"}
> > {#foo#|@count}
> > {#foo#|default:"no"}
> > {#foo#|truncate:6:"...":true}
> >
> > {$ofoo->blah}
> > {$ofoo->foo('bar')}
> > {$ofoo->foo("bar")}
> > {$ofoo->foo("$foo bar")}
> > {$ofoo->foo("one","two")}
> > {$ofoo->foo("one","two","three")}
> > {$ofoo->foo("one $foo","two","three")}
> > {$ofoo->foo("one $foo","two $foo","three")}
> > {$ofoo->foo("one","two","three","four")}
> > {$ofoo->foo('one $foo','two $foo','three')}
> > {$ofoo->foo('one')|upper}
> >
> > {ffoo var="foo"}
> > {ffoo var="foo" var2="blah"}
> > {ffoo var=$foo}
> > {ffoo var=truey}
> > {ffoo var=$foo|upper}
> > {ffoo var="foo"|upper}
> > {ffoo var=$ofoo->foo("$foo bar")}
> > {ffoo|upper var=$foo}
> >
> > {section name=sec loop=$sfoo}
> > {$sfoo[sec]}
> > {$sfoo[sec.index]}
> > {$sfoo[sec.index_next]}
> > {$sfoo[sec.index_prev]}
> > {$sfoo[sec.iteration]}
> > {$sfoo[sec.first]}
> > {$sfoo[sec.last]}
> > {$sfoo[sec.rownum]}
> > {$sfoo[sec.loop]}
> > {$sfoo[sec.total]}
> > {$sfoo[sec.show]}
> > {$sfoo[sec]|upper}
> > {$sfoo[sec]|upper|spacify}
> > {$sfoo[sec]|spacify:"^^"}
> > {$sfoo[sec]|@count}
> > {$sfoo[sec]|default:"no"}
> > {$sfoo[sec]|truncate:6:"...":true}
> > {/section}
> >
> > {$smarty.section.sec.index}
> >
> > {if $foo}{/if}(end)
> > {if $foo eq "bar"}foo is bar{/if}(end)
> > {if is_array($foo)}foo is array{else}foo is not array{/if}(end)
> > {if $foo gt 4}$foo is gt 4{/if}(end)
> > {if ($foo gt 4)}$foo is gt 4{/if}(end)
> > {if ( $foo gt 4 )}$foo is gt 4{/if}(end)
> > {if $foo and not $bar}foo and not bar{/if}(end)
> > {if !$bfoo}not bfoo{else}bfoo{/if}(end)
> > {if 4 is div by 4}div by 4{else}not div by 4{/if}(end)
> > {if 3 is div by 4}div by 4{else}not div by 4{/if}(end)
> > {if 3 is div by 4 or ( 3 eq 3 )}blah{/if}(end)
> > {if (3 is div by 4) or ( 3<="bah"|upper )}woohoo{/if}(end)
> > {if in_array("my $bar", $afoo)}is in{else}is not in{/if}(end)
> > {if $ofoo->foo()}is in{else}is not in{/if}(end)
> > {if in_array($ofoo->foo("two"), $afoo)}is in{else}is not in{/if}(end)
> >
> > {$smarty.now}
> > {$smarty.const._MY_CONST}
> >
> > {$foo|spacify:"|"}
> > {$foo|spacify:"|"|upper}
> > {$foo|spacify:"$foo"|upper|default:"|"}
> >
> > {section name=sec loop=$sfoo}
> >
> {$ofoo->foo($sfoo[sec],$sfoo[sec]|spacify:"^^",$sfoo[sec]|truncate:6:"...":t
> rue)}
> {$nfoo->ofoo->foo($sfoo[sec],$sfoo[sec]|spacify:"^^",$sfoo[sec]|truncate:6:"
> ...":true)}
> > {/section}
> >
> > {ffoo|spacify:"|"|upper var="lalala"}
> > {ffoo|spacify:" my spaces "|upper var="lalala"}
> > {ffoo|spacify:"!@#$%^&*()_+=-\|]["|upper var="lalala"}
> >
> >
> > {if !$nfoo->ofoo->foo("blah blah")}not blah{else}blah{/if}(end)
> >
> >
> > Monte
> >
> >
-- 
Monte Ohrt <monte@ispi.net>


-- 
Smarty Development Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic