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

Value of the $content for the opening block 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 -> Feature Requests
View previous topic :: View next topic  

Usefull feature?
Yes, i need something like this
100%
 100%  [ 1 ]
No, it's useless
0%
 0%  [ 0 ]
Total Votes : 1

Author Message
yor.gor
Smarty n00b


Joined: 06 Feb 2013
Posts: 2

PostPosted: Wed Feb 06, 2013 3:44 pm    Post subject: Value of the $content for the opening block function Reply with quote

Hi?

Manual says:
Quote:
The value of the $content variable depends on whether your function is called for the opening or closing tag. In case of the opening tag, it will be NULL, and in case of the closing tag it will be the contents of the template block. Note that the template block will have already been processed by Smarty, so all you will receive is the template output, not the template source.


Is it difficult to fill $content with nonprocessed template source in case of the opening tag, not with NULL?

I want to write some iterative block function, Grid for example, and content of this function will be some subtemplate, wich will be used iteratively as row template.

Code:
{grid data=$myData}
<tr><td>{$item->name}</td></tr>
{/grid}


So in php i will get not processed version of $content and treat it as row template, iterate throu $data, fill $item and display each iteration.

Now i see only not so beautyfull way to enclose content of my block function with {literal}, and trim it later in php.
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