2
J'ai un tableauindex de tableau Smarty
array('foo_1' => 1, 'bar_1' =>1, 'foo_2' => 2, 'bar_2' => 2, ...)
for($i = 1; $i<=12; $i++){
echo $month['foo_'.$i];
}
Et je ne comprends pas comment puis-je accéder aux valeurs de l'aide Smarty.
{counter start=0 skip=1 assign="i"}
{section name = month start = 0 loop = 12 step = 1}
{if isset($arr.foo_.$i)}
{$arr.bar_$i}
{/if}
{counter}
{/section}
Mais cela ne fonctionne pas. Le principal problème est - Comment puis-je accéder à array ['foo_1'] dans smarty? Peux-tu aider s'il te plait?
Je ne suis pas un programmeur PHP, mais n'est-ce pas un hachage et pas un tableau? – zellio
@Mimisbrunnr un HashTable est appelé un tableau en PHP;) – elslooo
Voulez-vous dire une table de hachage? En PHP il n'y a pas de tables de hachage comme en JAVA. Cependant, un tableau est une sorte de table de hachage n'est-ce pas? – alagar