Re: [SMARTY] Appending and prepending on a section?
| From: | Monte Ohrt | Date: | Tue, 30 Jul 2002 13:08:36 +0000 |
| Subject: | Re: [SMARTY] Appending and prepending on a section? | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-5507@lists.php.net to get a copy of this message | ||
{section name=somesection loop=$variable}
{if $smarty.section.somesection.first}<ul>{/if}
<li>{$variable[somesection].name}</li>
{if $smarty.section.somesection.last}</ul>{/if}
{sectionelse}
There were no names!{/section} Håvard Lindset wrote:
Hi, I wondered if there were a way to prepend and append something to a section? Let me give you all an example of what I think would be a good idea: (this is kind of a feature suggestion, unless there are other ways to achieve what I'm trying to do) --- {section name=somesection loop=$variable prepend="<ul>" append="</ul>"}-- Monte Ohrt <monte@ispi.net> Director of Technology, ispi Inc.<li>{$variable[somesection].name}</li>{sectionelse}There were no names!{/section} --- What I want to do is to only prepend and append something to the actual section (not the sectionelse). And yes, I know the prepend and append properties is non existent, I just wanted to show you how I would like it to be. I could just put <ul> and </ul> before and after the section, but because I don't want the "There were no names!" message inside those tags. I can't put them inside the section either, because then there would be created new <ul>'s every time it iterates through the array. I don't want to have {if}'s for checking wether or not to display the <ul>'s either. How can I achieve what I want to do? Thank you for your help! Best regards, Håvard Lindset kBase Developer http://www.webpixels.net http://kbase.webpixels.net