Re: [SMARTY-DEV] Simple math
| From: | messju mohr | Date: | Fri, 20 Jun 2003 09:30:17 +0000 |
| Subject: | Re: [SMARTY-DEV] Simple math | ||
| References: | 1 | Groups: | php.smarty.dev php.smarty.general |
| Request: | Send a blank email to php-smarty-dev+get-1627@lists.php.net to get a copy of this message | ||
On Fri, Jun 20, 2003 at 01:12:51PM +0400, Konstantin A. Pelepelin wrote:
> Hi!
>
> I need to make in template something like this
> {assign var="pages" value=count($items)/4}
{math assign="pages" equation="n/4" n=$items|@count}
but please, please keep this kind of logic out of the template.
>
> I cannot find a way to do this in Smarty 2.5.0 except of dirty hack with
> {php}{/php}
> Even simplier
> {$items|count}
> outputs only "Array"
read http://smarty.php.net/manual/en/language.modifiers.php
on why it
has to read @count and not count.
greetings
messju
> {math ...} doesn't support arrays too.
>
> Is there a way to solve it in Smarty 2.5.0 (except using custom functions)?
> If "No", then:
> Will it be possible in the next Smarty version and when it will be
> available?
> Has anyone a patch against Smarty 2.5.0 to make it possible?
>
> Thanks,
> Konstantin A. Pelepelin
>
> --
> Smarty Development Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php