Sam Wrote something to the effect of:
=====================================
Sorting belongs in the scripts/program...
-------------------------------------------------
(sorry, accidently deleted the original message)
==============================================
Sam, how about the sort_data subroutine as part of the core. Sorting
data (in scripts is not that uncommon) so perhaps the sort_data
subroutine would be good as part of the core?
simran.
On Thu, 2003-02-06 at 16:24, simran wrote:
> Hi Sam, at all,
>
> I have developed a patch to enable sorting within loops specifying the
> sort criteria within the template - don't know how useful others will
> find it, but i can think of it being useful to the designers around here
> anyway (and to me displaying the data sorted in different ways is a
> design issue for the most part, hence the development of the patch).
>
> >From the Documentation - Part of the patch:
> =========================================================================
> You can also sort the data within loops based on certian criteria.
> Aka, you can do the following:
>
> <TMPL_LOOP NAME=PRODUCTS SORTBY="name;order=desc;type=alpha">
> Name : <TMPL_VAR NAME=NAME>
> Description: <TMPL_VAR NAME=DESCRIPTION>
> ID : <TMPL_VAR NAME=ID>
> </TMPL_LOOP>
>
> The above will sort the loop on the "name" field, in ascending order
> based on alphanumeric sort. Please see the documentation for
> the sort_data() subroutine to see what is available as arguments
> to "order" and "type".
>
> Note: You can leave the order and type options out and detauls
> of "desc" and "alpha" will be used for them.
>
> Bugs: If you use the same loop multiple times in your template,
> the sort criteria for the very first loop will apply.
> (aka, any sort criteria given with the second/subsequent
> usage of the loop in the same template will be ignored).
> =========================================================================
>
> Do others think its a useful feature/patch? If so, Sam, can i please
> request for it to be patched into the core.
>
> thanks,
>
> simran.
|