I found the solution how to execute smarty in a smarty-tag:
{input type="text" name="articlename`$smarty.foreach.foreach_gallery.iteration`" title="Artikelbezeichnung:"}
You need to wrap the smarty-code with ``
Frage
I have one problem; I want to run a foreach-loop
and in the loop shall be items with the actual iterating number created.
My code so far:
{foreach from=$bilder item=item name=foreach_gallery}
{capture assign=shopBild}
<img src="{page_url page=$item}" border="0" alt="{$item->field.name}" title="{$item->field.title}" />
{/capture}
<tr>
<td width="250">
{$shopBild|max_image_width:160}<br/>
<input type="text" size="2" name="pic_id{$smarty.foreach.foreach_gallery.iteration}" value="{$item->field.id}" readonly>
</td>
<td>
{input type="text" name="articlename$smarty.foreach.foreach_gallery.iteration" title="Artikelbezeichnung:"}<br/>
{input type="textarea" name="description$smarty.foreach.foreach_gallery.iteration" title="Artikelbeschreibung:"}<br/>
{input type="text" name="articleid$smarty.foreach.foreach_gallery.iteration" title="Artikelnummer:"}<br/>
{input type="text" name="prize$smarty.foreach.foreach_gallery.iteration" title="Preis:"}<br/>
</td>
</tr>
{/foreach}
it works fine for the
<input type="text" size="2" name="pic_id{$smarty.foreach.foreach_gallery.iteration}" value="{$item->field.id}" readonly>
element but not in {input ...}
. Any idea why it doesn't work in the second case and how I could solve this problem?
Greez Sebastian
Lösung 2
I found the solution how to execute smarty in a smarty-tag:
{input type="text" name="articlename`$smarty.foreach.foreach_gallery.iteration`" title="Artikelbezeichnung:"}
You need to wrap the smarty-code with ``
Andere Tipps
You can try :
<input type="text" name="articlename{$smarty.foreach.foreach_gallery.iteration}" title="Artikelbezeichnung:">
instead of :
{input type="text" name="articlename$smarty.foreach.foreach_gallery.iteration" title="Artikelbezeichnung:"}
hope i help you.