Smarty Forum Index Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon.

probleme loop variable dynamique

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: French
View previous topic :: View next topic  
Author Message
jilham
Smarty n00b


Joined: 19 Mar 2008
Posts: 2

PostPosted: Wed Mar 19, 2008 11:01 am    Post subject: probleme loop variable dynamique Reply with quote

Bonjour à tous.
J'ai un petit souci, certainement de syntaxe mais peut être pas, je ne sais pas vraiment sinon je ne posterai pas. Smile

Voila ce que je souhaite faire avec smarty.

Dans mon fichier PHP
je fais des interrogations en base pour afficher des fiches clients.
Or un client peut avoir 1 ou plusieurs sites internets préférés que j'aimerai afficher sur ma page contenant plusieurs fiches clients.

J'ai donc 2 tableaux :
    celui contenant la liste des clients a afficher :

Quote:
$liste_client= Array();


    et un tableau associatif avec en clé l'ID du client et en valeur le tableau contenant les sites préférés du client :
Quote:
$liste_site_prefere[CLIENT_ID]= Array();


Le hic c'est que je n'arrive pas a afficher les données qu'il contient:

Je procède ainsi dans mon template :
1 - Je boucle sur mon tableau client
2 - J'affiche les données générales
3 - Je boucle sur le tableau des sites préférés en passant dans la valeur de l'ID du client

Quote:

{section name=client loop=$liste_client}

//AFFICHAGE DES DONNEES CLIENTS
ex: $liste_client[client].ID - $liste_client[client].NOM

//AFFICHAGE DES SITES PREFERES DU CLIENT EN COURS
{assign var=id_client value="$liste_client[client].ID"}
{section name=site loop= $liste_site_prefere[id_client]}
URL : {$liste_site_prefere[id_client][site].URL}
{/section}

{/section}



smarty affiche l'erreur suivant :

Quote:
Smarty error: [in client.tpl line 105]: syntax error: unrecognized tag: $liste_site_prefere["$liste_client[client].ID"][site].URL (Smarty_Compiler.class.php, line 446)


Bon c'est vrai c'est un poil compliqué - mais si vous voyez une autre manière de procéder je suis preneur!

merci à tous
Back to top
View user's profile Send private message
Display posts from previous:   
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Smarty Forum Index -> Language: French All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP