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

Prepending/appending smarty 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 -> Smarty 3
View previous topic :: View next topic  
Author Message
ilyalyu
Smarty Regular


Joined: 03 Nov 2009
Posts: 72

PostPosted: Fri Aug 24, 2012 8:26 pm    Post subject: Prepending/appending smarty blocks Reply with quote

Code:

template1.html
{block 'a'}1{/block}

template2.html
{extends 'template1.html'}
{block 'a' prepend}2{/block}

template3.html
{extends 'template2.html'}
{block 'a' append}3{/block}

template3.html output:
231

I would expect the following output:
213


It seems that Smarty (1) first appends 3 to 2, which produces 23 and (2) next prepends 23 to 1, which produces 231.

I would expect Smarty (1) first to extend template1, which should produce 21 and (2) next to extend template2, which should produce 213. In other words, if I use the code {block 'a' append}3{/block} in the last template, I expect to find 3 in the end, and not in the middle.
Back to top
View user's profile Send private message
U.Tews
Administrator


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

PostPosted: Fri Aug 24, 2012 11:52 pm    Post subject: Reply with quote

No, the processing order of templates is 1.) grandchild, 2.) child, 3.) parent.

The content of 231 is the expected result.
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 -> Smarty 3 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