RE: [SMARTY] section question
| From: | ThE PhP_KiD | Date: | Fri, 16 May 2003 15:48:49 +0000 |
| Subject: | RE: [SMARTY] section question | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-9561@lists.php.net to get a copy of this message | ||
Hi,
I've resolved:
<table border="1">
{section name=id loop=$customers step=2}
{math equation="x+1" x=$smarty.section.id.index assign="prox"}
<tr>
<td>Name: {$customers[id]}</td>
{if isset($customers[$prox])}
<td>Name: {$customers[$prox]}</td>
{else}
<td> </td>
{/if}
</tr>
{/section}
</table>
the "if" sentence, because you don't know if you have amount of
elements even or odd.
------------------------------------------------------
BUT trying this:
<table>
{section name=id loop=$customer step=2}
<tr>
<td>Name: {$customer[id]}</td>
<td>Name: {$customer[id+1]}</td>
</tr>
{/section}
</table>
I get next error:
Fatal error: Smarty: [in test.tpl line ...]: syntax error: unrecognized tag:
$customer[id+1] (Smarty_Compiler.class.php, line 382) in
c:\php\smarty\Smarty_Compiler.class.php on line 1824
------------------------------------------------------
Have you a more easy idea how can I get two columns customers ?
Thank you very much !!
--
...ThE PhP_KiD.
-> -----Mensaje original-----
-> De: gafonso@blackorange.pt [mailto:gafonso@blackorange.pt]
-> Enviado el: Jueves, 15 de Mayo de 2003 09:51 a.m.
-> Para: smarty-general@lists.php.net
-> Asunto: RE: [SMARTY] section question
->
->
-> this one is easy try this:
->
-> <table>
-> {section name=id loop=$customer step=2}
-> <tr>
-> <td>Name: {$customer[id]}</td>
->
-> <td>Name: {$customer[id+1]}</td>
-> </tr>
-> {/section}
-> </table>
->
->
-> Mensagem Original:
-> -----------------
-> De: ThE PhP_KiD gregoriandres@yahoo.com.ar
-> Data: Thu, 15 May 2003 09:33:17 -0300
-> Para: smarty-general@lists.php.net
-> Assunto: [SMARTY] section question
->
->
-> Hi,
->
-> There is a way to make a new iteration inside a section ?
->
-> example:
->
-> <table>
-> {section name=id loop=$customer step=2}
-> <tr>
-> <td>Name: {$customer[id]}</td>
->
-> <td>Name: ($customer[id+1]}</td>
-> </tr>
-> {/section}
-> </table>
->
-> The idea is put a customer list in 2 columns.
-> I try above code, but this: "($customer[id+1]}"
-> generates a smarty error.
->
-> If I could generate a new loop for this section,
-> between this columns, would be great !
->
-> I've look for on Smarty documentation, but I couldn't
-> found it.
->
-> Thanks!
->
-> ( and sorry for my poor english )
->
-> --
-> ...ThE PhP_KiD.
->
-> --
-> Smarty General Mailing List (http://smarty.php.net/)
-> To unsubscribe, visit: http://www.php.net/unsub.php
->
->
-> --------------------------------------------------------------------
-> mail2web - Verifique o seu correio electrónico na Web em
-> http://mail2web.com/ .
->
->
->
-> --
-> Smarty General Mailing List (http://smarty.php.net/)
-> To unsubscribe, visit: http://www.php.net/unsub.php