Re: [SMARTY] include headers and footers

From: Date: Tue, 04 Feb 2003 17:53:33 +0000
Subject: Re: [SMARTY] include headers and footers
References: 1 2 3  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-7515@lists.php.net to get a copy of this message
On Tue, Feb 04, 2003 at 09:32:33AM -0800, Desiree Rivera wrote: > Hi Everyone, > > Quick question (I hope!) > > I noticed in the examples/docs provided for smarty templates, there is > usually something like: > > {include file="header.tpl"} > > and > > {include file="footer.tpl"} > > Then in the header.tpl file, there's just something like (I'm simplifying > of course): > > <html> > <head> > </head> > <body> > > Then the closing tags in the footer.tpl file. > > In my smarty templates, I didn't use the header and footer files, I just > had the <html> and </html> tags in the template, etc. and it all works > fine. My question is this: is there any reason I shouldn't be doing things > this way? Is there any drawback to not using the header and footer files or > was this just included in examples to show that you can include files if > you desire? It's much easier for me to leave this code in the template > file because I edit the templates in Dreamweaver. I know this is a bit of a > boring Newb. question, but any input is appreciated! Thanks! the drawback comes when you have a lot of different templates, maybe for different sections of your site, and you want to change something in the header (the applied style-sheet for example). you have to touch and edit every template that contains the <head>-tag. if you just include header.tpl you have a central file you touch, and the change gets applied to every page on the site. have fun messju

« previous php.smarty.general (#7515) next »