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

Site engine

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


Joined: 18 May 2007
Posts: 1

PostPosted: Fri May 18, 2007 9:33 am    Post subject: Site engine Reply with quote

Hi.

I'm using smarty for the first time and have some questions about how to best set up the site engine.

I would like to use different templates for the different pages on my site. The template to use is stored in the pageproperties table in the database. So when I enter an page, the index.php is called who finds which template to use and displays the templte

Code:
$smarty->display('header.tpl');
$smarty->display($template);
$smarty->display('footer.tpl');


But I would like some functionality in the template. I.E. I need to get the content for the page which is stored in the database. The different templates have their own functions. How can I add this functionality to the templates? Do I have to include $template.php (in index.php) which display the .tpl file or can the .tpl run some functions in a php-file before render?

What is the best prectice for my problem?


//andersjo
Back to top
View user's profile Send private message
toma
Smarty Regular


Joined: 25 Apr 2003
Posts: 62

PostPosted: Fri May 18, 2007 6:21 pm    Post subject: Reply with quote

Check my article on organizing a Smarty project, http://smarty.incutio.com/?page=SmartestSmartyPractices and reply back with any specific questions you still have.

Tom A.
Back to top
View user's profile Send private message Visit poster's website
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