Smarty Forum Index Smarty
The discussions here are for Smarty, a template engine for the PHP programming language.
Smarty 3.1.8: post filter applies for every {block} + 1

 
Post new topic   Reply to topic    Smarty Forum Index -> Bugs
View previous topic :: View next topic  
Author Message
babai7395
Smarty n00b


Joined: 20 Feb 2013
Posts: 2

PostPosted: Wed Feb 20, 2013 6:44 pm    Post subject: Smarty 3.1.8: post filter applies for every {block} + 1 Reply with quote

Good day.

Post filter is called exactly count of inherited {block}'s +1 in child template.

Example root.tpl:
Code:
{block name="css"}111{/block}
{block name="css2"}222{/block}


child.tpl:
Code:
{extends file="root.tpl"}
{block name="css"}333{/block}
{block name="css2"}444{/block}


post filter:
Code:
function postFilter($compiled, $template)
{
   echo 'in postfilter; ';
   return '<?php echo "in postfilter;" ?>' . $compiled;
}
$smarty->registerFilter(
      'post',
      'postFilter'
);
$smarty->display('child.tpl');


If in child.tpl we inherit 2 blocks, postFilter will be called 3 times. If we inherit only 1 block, postfilter will be called 2 times.

Expected behavior: postFilter is called only 1 time on compiled template before saving it to filesystem, no matter how many blocks you inherit.
Back to top
View user's profile Send private message
babai7395
Smarty n00b


Joined: 20 Feb 2013
Posts: 2

PostPosted: Wed Feb 20, 2013 6:58 pm    Post subject: Reply with quote

Also tested on latest 3.1.13. Same results
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 4589
Location: Hamburg / Germany

PostPosted: Wed Feb 20, 2013 8:09 pm    Post subject: Reply with quote

Thank's for your input. I will try to fix this ASAP.
Back to top
View user's profile Send private message
U.Tews
Administrator


Joined: 22 Nov 2006
Posts: 4589
Location: Hamburg / Germany

PostPosted: Fri Apr 05, 2013 9:22 pm    Post subject: Reply with quote

This bug is now fixed in the SVN trunk.
The fix will later be included in version 3.1.14
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Smarty Forum Index -> Bugs 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