|
Smarty
WARNING: All discussion is moving to https://reddit.com/r/smarty, please go there! This forum will be closing soon. |
|
View previous topic :: View next topic |
Author |
Message |
simonhg Smarty n00b
Joined: 18 Nov 2014 Posts: 2
|
Posted: Tue Nov 18, 2014 12:41 pm Post subject: How to independent the reusable part with out include_php |
|
|
There are the same sidebar in almost all of my web pages.
It's a good idea to independent them,I think.
The problem is the need data from database. So it can't just {include file=XXX}. What worse is {include_php} is not deprecate.
I had considered the custom plugin. But I curious is there a better way to realize it.
Appreciate for your help. |
|
Back to top |
|
simonhg Smarty n00b
Joined: 18 Nov 2014 Posts: 2
|
Posted: Tue Nov 18, 2014 1:59 pm Post subject: A solution is ... |
|
|
I know a solution like this:
Write the php part as a plugin and then a template file calling it to assign the values.
Maybe it just the best way.
Just it complex my code and seems not perfect. |
|
Back to top |
|
AnrDaemon Administrator
Joined: 03 Dec 2012 Posts: 1785
|
Posted: Fri Nov 21, 2014 12:45 am Post subject: |
|
|
Perfect code is the one that nonexistent. So, any code that exists is not perfect by definition of perfection.
Read about template caching, it'll help. |
|
Back to top |
|
|
|
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
|