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

looping an include file

 
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 -> Feature Requests
View previous topic :: View next topic  
Author Message
fbronx
Smarty Rookie


Joined: 28 May 2003
Posts: 11
Location: Stekene, Belgium

PostPosted: Fri Jan 23, 2004 10:07 am    Post subject: looping an include file Reply with quote

Wouldn't it be nice to allow looping on included templates?
An example of what I mean:
Code:

{foreach name=book item=book from=$books}
 {if $smarty.foreach.book.first}
  <table>
 {/if}
 {include file="book.tpl"}
 {if $smarty.foreach.book.last}
  </table>
 {/if}
{/foreach}


book.tpl looks like:
Code:

 <tr>
  <td>$book.title</td>
  <td>$book.author</td>
 </tr>


Now if we could add looping on include:

Code:
{include file="book.tpl" name=book loop=$books}


where book.tpl will now look like:

Code:

{if $smarty.include.book.first}
 <table>
{/if}
 <tr>
  <td>$book.title</td>
  <td>$book.author</td>
 </tr>
{if $smarty.include.book.last}
 </table>
{/if}


Advantage: Smarty will do the looping now, instead of the designer.
When we could do this, there's no need anymore for a foreach or section statement.
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 -> Feature Requests 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