Re: [SMARTY] alphabetically down columns in a table
| From: | Abdul-Wahid Paterson | Date: | Mon, 10 Jan 2005 16:15:00 +0000 |
| Subject: | Re: [SMARTY] alphabetically down columns in a table | ||
| References: | 1 2 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-12138@lists.php.net to get a copy of this message | ||
This is nearly what I want in that it works. The only problem is that
my $array is actually an array of of arrays with each sub-array having
several different elements which have certain rules as to which should
be displayed (and how to be displayed depending on the theme). e.g. an
image, link, comment, description. Using the html_table method I would
have to have separate PHP functions for each "theme" using my site
code.
Any other ideas?
Abdul-Wahid
On Mon, 10 Jan 2005 18:10:19 +0300, messju mohr
<messju@lammfellpuschen.de> wrote:
> On Mon, Jan 10, 2005 at 02:40:28PM +0000, Abdul-Wahid Paterson wrote:
> > Hi,
> >
> > I have some data that I want to display in columns (2 or more) sorted
> > alphabetically. However, instead of going across the columns
> > alphabetically I want it to go down the columns. Is there any way of
> > doing this easily in smarty given an array of data.
> >
> > E.g...formatted data would be like
> >
> >
> > aa af ak
> > ab ag al
> > ac ah am
> > ad ai an
> > ae aj
> >
> > rather than like
> >
> >
> > aa ab ac
> > ad ae af
> > ag ah ai
> > aj ak l
> > am an
>
> if your array is one dimensional and sorted alphabetically, then this:
>
> {html_table inner=rows cols=3 loop=$array}
>
> should give the result you desire. "inner=rows" means: "put
> neighbouring values in the array into neighbouring rows in the
> table". the default is 'inner="cols"' and gives your second examples
> (the not desired one) as output.
>
> HTH
> messju
>
> > Thanks,
> >
> > Abdul-Wahid
> >
> > --
> > Smarty General Mailing List (http://smarty.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
>