Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.

Search found 2 matches
Smarty Forum Index
Author Message
  Topic: Sorting arrays inside templates
pscsuk

Replies: 28
Views: 166078

PostForum: General   Posted: Fri Aug 19, 2005 9:51 am   Subject: Sorting arrays inside templates
Slight modification - change
$code .= "if ( ( \$c = (\$a['$key'] - \$b['$key'])) != 0 ) return $d * \$c;\n";

to
$code .= "if ( \$a[' ...
  Topic: Sorting arrays inside templates
pscsuk

Replies: 28
Views: 166078

PostForum: General   Posted: Fri Aug 19, 2005 9:39 am   Subject: Sorting arrays inside templates
I know this is a bit 'late', but here's my modification of this. Now, you can specify

{foreach from=$users|sortby"-name, #age" item=user}
The '-' lets you sort in reverse order ...
 
Page 1 of 1
All times are GMT
Jump to:  


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP