Re: [SMARTY] alphabetical list with A,B,C headers?
| From: | sweatjejm at mchsi dot com | Date: | Wed, 04 Dec 2002 23:06:18 +0000 |
| Subject: | Re: [SMARTY] alphabetical list with A,B,C headers? | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-6642@lists.php.net to get a copy of this message | ||
What you want to do sounds similar to something I did recently where I wanted
to output an anchor tag when a repeating value in the array changed. You
should be able to do the same thing, but working off of a trimmed character:
Here is some of my relevant code:
{assign var="oldsort" value="notset"}
{section name=c loop=$catlg}
<tr>
{if $oldsort neq $catlg[c].SORT1}
{assign var="oldsort" value=$catlg[c].SORT1}
{if $oldsort eq '1'}
<a name="instock" id="instock" />
{elseif $oldsort eq '2'}
<a name="shortflow" id="shortflow" />
{elseif $oldsort eq '3'}
<a name="stockout" id="stockout" />
{/if}
{/if}
...
{/section}
>
> Hello everyone,
>
> I'm rather new to smarty templates (been using PHPLIB for a while
> and was *blown* away at how easy Smarty is!!). Anyway I've got a list of
> product titles and I'm trying to print them out with their first letter as
> the header:
>
> --->A<---
> A Something
> Apples
> Axe
>
> --->B<---
> Blue
> Berries
> Bakers
>
> --->C<---
> etc....
>
> Any help would be fantastic!
>
> later,
> ajay
>
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>