Re: [SMARTY] Re: [SMARTY-DEV] Simple math
| From: | Wom.bat | Date: | Fri, 20 Jun 2003 10:53:21 +0000 |
| Subject: | Re: [SMARTY] Re: [SMARTY-DEV] Simple math | ||
| References: | 1 2 3 | Groups: | php.smarty.dev php.smarty.general |
| Request: | Send a blank email to php-smarty-dev+get-1628@lists.php.net to get a copy of this message | ||
:>
> Hi!
>
> > {math assign="pages" equation="n/4" n=$items|@count}
> >
> > but please, please keep this kind of logic out of the
> > template.
> First, this time I can't.
> Second, it's template designer's decision on how many items
> to show on page.
>
>
>
> > read
> > http://smarty.php.net/manual/en/language.modifiers.php on
> > why it has to read @count and not count.
> Thank you, sorry for this question.
>
>
> Anyway, I'd like to have simple math in simple syntax in
> next Smarty version, or at least, {math} as a compiler
> function.
the current CVS version has "real" math implemented, so you can do things
like
{$foo->bar-$bar[1]*$baz->foo->bar()-3*7}
{if ($foo+$bar.test%$baz*134232+10+$b+10)}
{$foo|truncate:"
$fooTruncCount/$barTruncCoefficient-1"}
{assign var="foo" value="$foo+$bar"}
feel free to test it out ;)
David