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

How to independent the reusable part with out include_php

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


Joined: 18 Nov 2014
Posts: 2

PostPosted: Tue Nov 18, 2014 12:41 pm    Post subject: How to independent the reusable part with out include_php Reply with quote

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
View user's profile Send private message Send e-mail
simonhg
Smarty n00b


Joined: 18 Nov 2014
Posts: 2

PostPosted: Tue Nov 18, 2014 1:59 pm    Post subject: A solution is ... Reply with quote

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
View user's profile Send private message Send e-mail
AnrDaemon
Administrator


Joined: 03 Dec 2012
Posts: 1785

PostPosted: Fri Nov 21, 2014 12:45 am    Post subject: Reply with quote

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
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