Re: [SMARTY] Smarty, PEAR, Associative Array and Loops

From: Date: Wed, 06 Apr 2005 12:56:56 +0000
Subject: Re: [SMARTY] Smarty, PEAR, Associative Array and Loops
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-12416@lists.php.net to get a copy of this message
Reynier Pérez Mira wrote:
Can you explain a little more?? I not understand. I'm new in the world of Smarty.
instead of: while($row = $evenres->fetchRow()){
        array_push($titulo,$row[1]);
        array_push($descripcion,$row[2]);
        array_push($contenido,$row[3]);
        $template->assign("titArr",$titulo);
        $template->assign("descArr",$contenido);
        $template->assign("conArr",$descripcion);
} use: while($row = $evenres->fetchRow()){
        array_push($titulo,$row[1]);
        array_push($descripcion,$row[2]);
        array_push($contenido,$row[3]);
} $template->assign("titArr",$titulo); $template->assign("descArr",$contenido); $template->assign("conArr",$descripcion); addionally the name attribute in the section is the index so: instead of {section name=titulo loop=$titArr}
      <tr>
        <td width="3%" valign="top" class="tddoted"
align="center"><strong>{$smarty.section.eventos.rownum}.</strong></td>
        <td width="97%" class="padding-td
tddoted">{$evenArr[eventos]}</td> use: {section name=titulo loop=$titArr}
      <tr>
        <td width="3%" valign="top" class="tddoted"
align="center"><strong>{$smarty.section.titulo.index}.</strong></td>
        <td width="97%" class="padding-td tddoted">{$evenArr[titulo]}</td>
-- http://www.xs4all.nl/~hanb/documents/quotingguide.html

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