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

Making a custom function

 
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 -> General
View previous topic :: View next topic  
Author Message
sam
Smarty n00b


Joined: 23 Apr 2003
Posts: 2

PostPosted: Sun Apr 27, 2003 12:32 am    Post subject: Making a custom function Reply with quote

Hey,

I'm planning to make a custom function for use in Smarty templates and I'm wondering if you guys have any input on how I could/should do it.

Basically, what I want is:
Code:
{makebox cellspacing="2" cellpadding="0"}
    {section name="smth" loop=$smth_data}
        {$smth_data[smth].smth}
    {/section}
{/makebox}

Where makebox is my custom function.

The above function should return (without the comments (they're just there for explanation)):
Code:
<!-- start {makebox} //-->
<table cellspacing="2" cellpadding="0">
 <tr>
  <td>
<!-- end {makebox} //-->
   something
<!-- start {/makebox} //-->
  </td>
 </tr>
</table>
<!-- end {/makebox} //-->

I looked into the Smarty code for some ideas (Smarty_Compiler.class.php) but I thought there might be an easier way than fiddling around in the Smarty source.

Any ideas is appreciated.
Back to top
View user's profile Send private message
AZTEK
Smarty Pro


Joined: 16 Apr 2003
Posts: 235
Location: Purdue University

PostPosted: Sun Apr 27, 2003 12:44 am    Post subject: Reply with quote

that could be done with custom blocks easily
_________________
"Imagine a school with children that can read and write, but with teachers who cannot, and you have a metaphor of the Information Age in which we live." -Peter Cochrane
Back to top
View user's profile Send private message Visit poster's website
sam
Smarty n00b


Joined: 23 Apr 2003
Posts: 2

PostPosted: Sun Apr 27, 2003 12:51 am    Post subject: Reply with quote

Thanks, I'll look into it Smile
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 -> General 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