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

[résolu] récupération d'un tableau php en smarty

 
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
boup
Smarty Rookie


Joined: 25 Aug 2010
Posts: 5

PostPosted: Thu Sep 16, 2010 4:05 pm    Post subject: [résolu] récupération d'un tableau php en smarty Reply with quote

Bonjour je suis un peu perdu pour la récupération d'élément de mon tableau php en Smarty:

voici mon tableau php

Code:

$event = array();
$event['2010-9-5'][] = array("type"=>"cine", "event"=>"film qui sortira");

$smarty->assign("event", $event);


je sais comment récupéré la date mais je ne vois pas du tout comment récupéré la valeur de type et celle de event

Code:


{foreach from=$event key=k item=v}

 <div id="date{$k}">
   <p>type event</p>
 </div>

{/foreach}



si quelqu'un à une idée ca m'aiderait vraiment

Merci

boup'


Last edited by boup on Mon Oct 04, 2010 1:52 pm; edited 1 time in total
Back to top
View user's profile Send private message
Gowser
Smarty Pro


Joined: 19 Feb 2008
Posts: 104
Location: Nantes (France)

PostPosted: Mon Oct 04, 2010 9:51 am    Post subject: Reply with quote

Bonjour,

Il faut faire
Code:

{foreach from=$event key=k item=v}

 <div id="date{$k}">
   <p>
     type : {v.type}
     event : {v.event}
   </p>
 </div>

{/foreach}
Back to top
View user's profile Send private message Send e-mail
boup
Smarty Rookie


Joined: 25 Aug 2010
Posts: 5

PostPosted: Mon Oct 04, 2010 1:51 pm    Post subject: Reply with quote

J'ai essayé mais ça ne va pas ..

J'ai trouvé la solution =)

Code:


{foreach key=k item=events from=$event}
  <div id="{$k}">
    {foreach item=v from=$events}
      <p>{$v.titre}</p>
      <p>{$v.event}</p>
    {/foreach}
  </div>
{/foreach}

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