You are here: Re: [SMARTY] accessing an array var with a variable name « Smarty Templates Posts « IT news, forums, messages
Re: [SMARTY] accessing an array var with a variable name

Posted by Jens Kleikamp on 10/21/05 19:02

Kathleen Krause-Thompson wrote:
> Thank you for help provided in the past.
>
> This time, I am using the section tag and would like to access an array using the $smarty.section.name.index variable (see the ??? below).
>
> --------------------------------
>
> {section name=ill start=1 loop=$num+1 step=1}
>
> <p>Job Title {$smarty.section.ill.index}
>
> {if !empty($errors.budget?????.baseSalAmt)}<span id="errortext">{$errors.budget?????.baseSalAmt}</span>{/if}
>
> {/section}
>
> ----------------------------
>
> ?????? is where I would like for the $smarty.section.ill.index to go, for example {$errors.budget2.baseSalAmt}. How would I access this array variable dynamically?
>

Iám not sure, but this could work:

{section name=ill start=1 loop=$num+1 step=1}

<p>Job Title {$smarty.section.ill.index}

{if !empty($errors.budget?????.baseSalAmt)}
{assign var="index" value=budget`$smarty.section.ill.index`}
<span id="errortext">{$errors.$index.baseSalAmt}</span>
{/if}

{/section}

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация