|
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 |
TheOddPerson Smarty n00b
Joined: 19 May 2013 Posts: 3 Location: Canada
|
Posted: Tue Sep 03, 2013 4:08 pm Post subject: Smarty Theory - Should template define required content? |
|
|
Hello
I am programmer, I've built a few websites previously but this is my first time using smarty, php, and I haven't used much Javascript before.
I'm using PHP 5.4, Smarty 3, MySQL 5.5 with Apache 2.2 on a Raspberry Pi.
Anyways my question is this --
Should it be left to the template designer what content to display on specific pages or should it be hard coded into the .php file?
ie:
index.php includes:
Quote: |
$smarty->display('htmlstart.tpl');
$smarty->display('header.tpl');
$smarty->display('userbuttons.tpl');
$smarty->display('leftmenu.tpl');
$smarty->display('search.tpl');
$smarty->display('content.tpl');
$smarty->display('othercontent.tpl');
$smarty->display('morecontent.tpl');
$smarty->display('map.tpl');
$smarty->display('footer.tpl');
$smarty->display('htmlend.tpl');
..and there could be more..
|
I guess there could be a bunch of 'ifs' in the php customizing the content, or perhaps I could let the browser request (Get/Post) define which content is displayed..
or should the template be able to call upon each of those 'modules' as it needs. I would like the website to be as dynamic as possible and having each component/module of the website segregated into divs and placed into it's own .tpl file seems like a logical solution but may make the actual presentation code of the website messy.. say when I want to display a list of articles and only display edit/moderation buttons for certain users.
soo I was thinking of rather than having the .php code define what data the presentation code gets and what files it needs to display, I could possibly have the html code request whatever data/modules it needs whenever the template designer thinks it's necessary.
I'm just not certain how I would program that with javascript or perhaps I should be using a different language or method?
I would like to get a handle on the 'theory' and 'best practices' of using Smarty before I'm several hundred lines down the wrong coding path.
Thank you all for your help. |
|
Back to top |
|
TheOddPerson Smarty n00b
Joined: 19 May 2013 Posts: 3 Location: Canada
|
Posted: Wed Sep 04, 2013 3:25 pm Post subject: |
|
|
*pretends to be someone else*
See Template Inheritance |
|
Back to top |
|
U.Tews Administrator
Joined: 22 Nov 2006 Posts: 5068 Location: Hamburg / Germany
|
|
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
|