Re: [SMARTY] size of array
| From: | Abdul-Wahid Paterson | Date: | Tue, 11 Jan 2005 12:03:23 +0000 |
| Subject: | Re: [SMARTY] size of array | ||
| References: | 1 2 3 4 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-12145@lists.php.net to get a copy of this message | ||
Thanks for that Messju, My whole point of resisting doing this in the
PHP code is because what I am trying to achieve is actually for a
formatting issue for a particular client. I have many clients who use
my code and the code base is huge. The clients only have to provide
their own templates, config file and their own css and they have their
own site.
This is actually related to my earlier email about table columns
sorted alphabetically across rather than down. I thought of a way of
creating a plugin template that coud do the table with to {sections}
but it only works if I know the overal size of the array and I don't
want to change the PHP code for one client when the changes would have
to be made in many places in the PHP code.
Thanks for your help.
Abdul-Wahid
On Tue, 11 Jan 2005 14:44:43 +0300, messju mohr
<messju@lammfellpuschen.de> wrote:
> On Tue, Jan 11, 2005 at 11:15:29AM +0000, Abdul-Wahid Paterson wrote:
> > Thanks messju for that but I should have been a bit clearer. I need
> > something a bit more.
> >
> > I really want to be able to carry out a mathematical funciton on the
> > size of the array before displaying the result
> >
> > something like
> >
> > {assign var="length" value=count($array)/2}
>
> then you can
>
> a) check wether it's easier/cleaner/smarty to do this computation on
> the php-side where $array comes from.
>
> and if a) doesn't work out
>
> b) {math equation="count/2" count=$array|@count assign=length}'
>
> greetings
> messju
>
> > On Tue, 11 Jan 2005 14:08:39 +0300, messju mohr
> > <messju@lammfellpuschen.de> wrote:
> > > On Tue, Jan 11, 2005 at 10:42:16AM +0000, Abdul-Wahid Paterson wrote:
> > > > Hi,
> > > >
> > > > Is there a way of finding out the size of an array from within a
> > > > smarty template?
> > >
> > > {$array|@count}
> > >
> > > it's one of the examples at
> > >
> > > http://smarty.php.net/manual/en/language.modifiers.php
> > >
> > > > Abdul-Wahid
> > > >
> > > > --
> > > > Smarty General Mailing List (http://smarty.php.net/)
> > > > To unsubscribe, visit:
> > > > http://www.php.net/unsub.php
> > >
>