From smarty-general Fri Oct 10 15:06:43 2003 From: Gabriel Birke Date: Fri, 10 Oct 2003 15:06:43 +0000 To: smarty-general Subject: Re: [SMARTY] Coding style?? X-MARC-Message: https://marc.info/?l=smarty-general&m=106579840911880 I don't know if this is good or bad coding style or if this style affects performance (although I think it does increase the amount of RAM needed). I would rather only display main.tpl and build main.tpl like this:: {include file="head.tpl"} {include file="nav.tpl"} .. {include file="foot"} Place the includes where the variable names were. The number of templates used is okay, because you don't have to browse through 100+ lines of template code when you want to change something in the footer etc. Am Freitag, 10.10.03 um 16:46 Uhr schrieb JohannesF - Poeter.se: > Hi all of you, I hope you can read this, my english is kind of poor... > > But I need advise about coding style and use of SMARTY. Here I have > posted a > sample of code where I use lots of templates that in the end all is put > together i a main.tpl that display the page. > > Is this yau of using SMARY bad? I mean, insted I could use lesser > tempaltes > to display my page. And for example insted use include. In this example > there are lots of fetching from the db, that migth bee bad for speed. > > Please sort it out for me, I need som clue on a good coding style for > SMARTY!! thank you and have a good weekend. > > / JohannesF > > --------------------------------- > require_once 'setup.php'; > > $smarty->assign("head", $smarty->fetch('db:head.tpl')); > $smarty->assign("foot", $smarty->fetch('db:foot.tpl')); > $smarty->assign("nav", $smarty->fetch('db:nav.tpl')); > $smarty->assign("campain", $smarty->fetch('db:campain.tpl')); > $smarty->assign("sponsor", $smarty->fetch('db:sponsor.tpl')); > > require_once 'nav_page_load.php'; > $smarty->assign("nav_page", $smarty->fetch('db:nav_page.tpl')); > > $smarty->assign("page", $smarty->fetch('db:textpage.tpl')); > > $smarty->display("db:main.tpl"); > > > > ----------------------------- > Johannes Fosseus > http://www.poeter.se - Skön kultur på Internet > http://www.mindagbok.se - Dagbok på Internet > > -- > Smarty General Mailing List (http://smarty.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > With best regards Gabriel Birke -- KONTOR4_Neue Medien Nelkenstrasse 3 31515 Wunstorf Germany Phone: +49 5031-955244 Fax: +49 5031-955231 mailto:birke@kontor4.de http://www.kontor4.de -- Smarty General Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php