|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
boup Smarty Rookie
Joined: 25 Aug 2010 Posts: 5
|
Posted: Thu Sep 16, 2010 4:05 pm Post subject: [résolu] récupération d'un tableau php en smarty |
|
|
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 |
|
Gowser Smarty Pro
Joined: 19 Feb 2008 Posts: 104 Location: Nantes (France)
|
Posted: Mon Oct 04, 2010 9:51 am Post subject: |
|
|
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 |
|
boup Smarty Rookie
Joined: 25 Aug 2010 Posts: 5
|
Posted: Mon Oct 04, 2010 1:51 pm Post subject: |
|
|
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 |
|
|
|
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
|