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

Create functions in intermediate inherited templates?

 
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
hexetic
Smarty n00b


Joined: 08 Dec 2015
Posts: 3

PostPosted: Tue Dec 08, 2015 7:52 pm    Post subject: Create functions in intermediate inherited templates? Reply with quote

If I have the inheritance chain A->B->C (i.e., C extends from B which extends from A), it seems like there's no way for B to declare a {function} that {C} could use. The Smarty docs say that the compiler will ignore anything except {block} declarations in B.tpl, but there's no way for C to use functions declared within one of B's blocks, is that right?

I would really like to be able to declare functions in B that would be visible to B's children but not to all of A's children. A is a global presentation template that defines the basic layout of the webpage. B is a refinement for a specific area of the website. C is a particular page. There are some things which are common to B's area but none of the other pages.
Back to top
View user's profile Send private message
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Wed Dec 09, 2015 12:09 pm    Post subject: Reply with quote

Overengineering at its finest.
Do not define "functions in templates", problem solved.
If you need template function, define it as a plugin.
Back to top
View user's profile Send private message
U.Tews
Administrator


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

PostPosted: Thu Dec 10, 2015 4:47 am    Post subject: Reply with quote

This will be possible with the next release 3.1.28 which I will release next week. You can try already the version in the master branch on github.
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