|
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 |
duffbt Smarty n00b
Joined: 28 Aug 2013 Posts: 1
|
Posted: Fri Sep 06, 2013 3:04 pm Post subject: Smarty array |
|
|
Hi,
I want to show my shopping cart with smarty but nothing works.
Here my php code :
Code: |
for ($i = 0 ; $i < $count; $i++) {
$tpl->append('cart', $_SESSION['cart']);
}
|
And in my template:
Code: |
{section name=cart loop=$cart}
{$cart[cart].id}<br/>
{$cart[cart].name}
{/section}
|
Someone can help me please? |
|
Back to top |
|
IT_Services Smarty Rookie
Joined: 30 Sep 2013 Posts: 9
|
Posted: Mon Sep 30, 2013 9:49 am Post subject: |
|
|
If $_SESSION['cart'] already contains the required array you don't need to acces 'cart' a second time in template:
Code: | {foreach $cart as $item}
{$item.id}<br/>
{$item.name}
{/foreach} |
But what does/should your php-for-loop do?
Regards
Florian |
|
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
|