other counting variable in {section} / using css in templates
| From: | Webmaster | Date: | Fri, 07 Nov 2003 10:16:18 +0000 |
| Subject: | other counting variable in {section} / using css in templates | ||
| Groups: | php.smarty.general | ||
| Request: | Send a blank email to php-smarty-general+get-10505@lists.php.net to get a copy of this message | ||
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?
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?
Thank you very much.
Webmaster