Je veux obtenir une données de tableau à deux dimensions et l'afficher dans un fichier html en utilisant smarty: L'idée est la suivante: ma matrice contient plusieurs tableaux tout le monde contient le nom de la catégorie dans le premier offset et les liens attachés à cette catégorieSmarty affecter et afficher tableau bidimensionnel
1-fichier php
$categories_links = array();//array that contains some catgories name with the attached links
//some dummy data
$categorie1="Horror movies";
$link11="http://www.movie11.com";
$link12="http://www.movie12.com";
$link13="http://www.movie13.com";
$categories_links[] = array($categorie1, $link11, $link12,$link13);
$categorie2="Action movies";
$link21="http://www.movie21.com";
$link22="http://www.movie22.com";
$categories_links[] = array($categorie2, $link21, $link22);
$smarty->assign('categories_links' , $categories_links);
$smarty->display('file.html');
2-fichier html
{foreach key=categorie item=categorie from=$categories_links}
foreach key=categorie item=categorie from=categorie}
<!--
1.display only the first item in every array as the category name
2.display the rest as the links attached to the above category
//-->
{/foreach}
{/foreach}
Vous devez éditer votre question et mettre quelques exemples de données au format PHP (pas var_dump) –
J'ai ajouté quelques données factices –