|
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 |
billmn Smarty n00b
Joined: 28 Dec 2010 Posts: 2 Location: Mantova, Italy
|
Posted: Tue Dec 28, 2010 11:14 am Post subject: Loop content and assign on every iteration |
|
|
Hi!
I would make something like this :
Code: | {products order="asc"}
<div>{$product.title}</div>
<div>{$product.description}</div>
{/products} |
If I have 5 products in database I would repeat the block content 5 times and assign product informations to $product variable on every iteration, for example :
Code: | <div>Product 1</div>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>
<div>Product 2</div>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div>
<div>Product 3</div>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</div> |
I read this topic ( http://www.smarty.net/forums/viewtopic.php?t=4798 ) but I don't understand how to repeat block content and assign values on every iterations.
Can you help me? |
|
Back to top |
|
mohrt Administrator
Joined: 16 Apr 2003 Posts: 7368 Location: Lincoln Nebraska, USA
|
|
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
|