Re: [SMARTY] other counting variable in {section} / using css in templates

From: Date: Fri, 07 Nov 2003 11:50:35 +0000
Subject: Re: [SMARTY] other counting variable in {section} / using css in templates
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-10506@lists.php.net to get a copy of this message
On Fri, Nov 07, 2003 at 11:16:18AM +0100, Webmaster wrote: > Hi, > > I have 2 questions. > > First question) > > I use the following section of code in our product catalog to display item > in a table. > > {section name=i loop=$dataItems} > <tr align="center" > onmouseover="this.style.background='#ff0000';" > onmouseout="this.style.background='#ffffff';"> > <td align="right">{$dataItems[i].d_artikelnummer}</td> > {if $dataItem.d_bild_artikel != ""} > <td align="right"> > <a href="../images/shop/products/{$dataItems[i].d_bild_artikel}.jpg" > target="_blank">{$dataItems[i].d_description}</a> > </td> > > {else} > <td align="right">{$dataItems[i].d_description}</td> > {/if} > > <td align="right">{$dataItems[i].d_anz_vpe} x {$dataItems[i].d_vpe} > {$dataItems[i].d_mass}</td> > <td align="right">EUR {$dataItems[i].d_ab1}</td> > {if $discountShown == 6} > <td align="right">EUR {$dataItems[i].d_ab6}</td> > {elseif $discountShown == 12} > <td align="right">EUR {$dataItems[i].d_ab12}</td> > {else} > <td align="right">EUR {$dataItem[i].d_ab4}</td> > {/if} sssssssssssssssssssssss > > <td align="right"> > <input type="text" name="anzahlNeu[{i}]" size="2" > maxlength="2" > onfocus="document.all.rowcolor.{i}.style.background='#ffff00'" /> > <input type="hidden" name="artikel_id[{i}]" > value="{$dataItems[i].d_artikelnummer}" /> > </td> > </tr> > {/section} > > But I also need to increment the variable i in the array anzahlNeu[i] and > artikel_id[i] because i will pass those to the shopping card. How can I > achieve that? http://smarty.php.net/manual/en/section.property.index.php http://smarty.php.net/manual/en/section.property.iteration.php or http://smarty.php.net/manual/en/language.function.counter.php > Second question) > > I would like to have style definition within the header of my html files. > But smarty always gives me error messages as the style definitions also use > the braces "{" and "}". > Is there a way to work around that problem? http://smarty.php.net/manual/en/language.function.literal.php HTH messju > Thank you very much. > > Webmaster

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