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

processing internal blocks

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


Joined: 26 Feb 2004
Posts: 6
Location: Silver Spring, MD

PostPosted: Fri Feb 27, 2004 2:26 pm    Post subject: processing internal blocks Reply with quote

I'm looking for a way to process an internal block in a template so that the same block can be used multiple times within a template file. I currently do not see any way to do this from the documentation or searching around the forums. Forgive me if I've missed something.

For instance, Say I have the following template file:
Code:
Here is some content
{process block="table" right="some stuff" left="More stuff"}

... a bunch of random content ...

{process block="table" right="Look at me go!" left="Yeehaw"}

... maybe some more random content ...

{block name="table"}
<table width="{$width}">
  <tr>
    <td>{$left}</td>
    <td>{$right}</td>
  </tr>
</table>
{/block}


I want to be able to build a 'block' of template code that can be 'processed' in several locations of the same file. I know it would be possible to save that 'table' block as a seperate file and then {include} it with the proper attrs being passed to it to fill in it's content. But I feel it would be extremely useful to be able to include small blocks like this all inside the same template file. It can save a lot of duplication and extra files wouldn't need to be created for it to work.

I also can not create my own plugin to do this, since there's no way for me to create a 'block' and not have its internals processed by smarty until a {process} directive is called for the block.
_________________
Jason Morriss
http://www.psychostats.com/
Back to top
View user's profile Send private message Send e-mail Visit poster's website
boots
Administrator


Joined: 16 Apr 2003
Posts: 5611
Location: Toronto, Canada

PostPosted: Fri Feb 27, 2004 7:39 pm    Post subject: Reply with quote

Well, you can always segregate the template portions to their own files and then include them. Alternatively, you can consider the following interesting thread.
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