Re: [SMARTY] Simple (I suppose..) Problem with section...

From: Date: Fri, 31 May 2002 15:12:51 +0000
Subject: Re: [SMARTY] Simple (I suppose..) Problem with section...
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-4483@lists.php.net to get a copy of this message
Another alternative (from the top of my head, not tested code) might be: <HTML> <TITLE>Hello</TITLE> <BODY> {section name=people loop=$membri} {if $smarty.section.people.first}<TABLE>{/if} <TR><TD>{$membri[people].nome}</TD><TD>{$membri[people].email}</TD></TR> {if $smarty.section.people.last}</TABLE>{/if} {sectionelse} Nessun membro è stato definito {/section} <p> Ci sono {$smarty.section.people.loop} membri nel database. </BODY> </HTML> or in your original code, you could just embed the message in a cell {sectionelse} <tr><td> Nessun membro è stato definito</td></tr> {/section} ----- Original Message ----- From: "Fabio" <fabiogandola@tiscalinet.it> To: <smarty-general@lists.php.net> Sent: Friday, May 31, 2002 4:42 AM Subject: [SMARTY] Simple (I suppose..) Problem with section... > I've created this template: > > <HTML> > <TITLE>Hello</TITLE> > <BODY> > <TABLE> > {section name=people loop=$membri} > > <TR><TD>{$membri[people].nome}</TD><TD>{$membri[people].email}</TD></TR> > {sectionelse} > Nessun membro è stato definito > {/section} > </TABLE> > <p> > Ci sono {$smarty.section.people.loop} membri nel database. > </BODY> > </HTML> > > My problem is that when the "people" section is empty.. the message "Nessun > membro è stato definito" is diplayed between the <TABLE></TABLE>... Instead > I would like that the <TABLE></TABLE> will be used only if there are members > to display in the table rows... > And the "No members ..." message should not be in the <TABLE></TABLE>.. > > I hope to have explained what I'm trying to explain... :-P > > Thank you. > > > -- > Smarty General Mailing List (http://smarty.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >

« previous php.smarty.general (#4483) next »