Re: Smarty's Smartest Practices?

From: Date: Wed, 19 Feb 2003 16:07:11 +0000
Subject: Re: Smarty's Smartest Practices?
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-7892@lists.php.net to get a copy of this message
I use Smarty with a modular CMS I develop(ed) which is very similar to PHP/PostNuke (at least how it is organized). I have a template for my ThemeEngine which looks like your "standard_page.tpl". All other content is also included in it. It would be impossible to add to each template of each module a {header} and {footer} tag. So this approach is alot better for me too. André "Mike Van Lammeren" <mike@emerge2.com> schrieb im Newsbeitrag news:5.1.0.14.0.20030219101105.02b48b70@mail.emerge2.com... > I've been lurking on this list for a little while now, and just want to say > that Smarty is absolutely brilliant! I have completed a few commercial > projects with Smarty, and find that it integrates perfectly with the way we > develop. It's as though Smarty was custom-written for us. Thanks to > everyone involved! > > A little while ago, Tom Sommer wrote: > >I don't want to hear about including top and bottom headers, since I've > >worked that way for a long time and have come to love my new way of working > >with templates :) > > Well, no offence to Tom, but I am curious about how people organize the > html in their templates. Over the years, we have done projects in ASP, > Perl, and most recently, PHP. (They'll get PHP away from me when they pry > it from my cold, dead hands!) We've tried a number of approaches when it > comes to laying out html templates, but more often than not, we settle on a > single page, which includes every tag from <html> to </html>. We keep this > page short, preferably under 100 lines, then include everything else from > other files, such as css, javascript, a layer for drop-down menus, etc. The > dynamic content is poured into a number of places, such as the body of the > page, a navigation side-bar, etc. > > Here is a simplified example: > > standard_page.tpl > <html> > <head> > <title>ABC Company: {$title}</title> > {include file="standard_header.tpl"} > </head> > <body> > <table> > <tr> > <td colspan="2"> > {include file="top_menu_links.tpl"} > </td> > </tr> > <tr> > <td colspan="2"> > <h1>ABC Company</h1> > <h2>{$title}</h2> > logged in as: {$login_name} > </td> > </tr> > <tr> > <td> > <h1>Side Menu</h1> > {$side_menu_links.tpl} > </td> > <td> > <!-- main page body --> > {include file="some_body.tpl"} > </td> > </tr> > </table> > </body> > </html> > > What you should know about our projects is that they are typically > database-driven web applications, with around 6 to 10 actual pages. While > one page, for instance, may allow access to an archive of hundreds of press > releases, it is still only one page to the webserver. > > If we had hundreds of pages with static bodies, then we would probably go > for an arrangement whereby the html making up the body would go in a file > which included header and footer files. (What Tom refers to as the "top and > bottom headers" approach.) > > Now that you know where Tom and I stand, what do you think? What do you do? > > > -- > Mike van Lammeren > Web Application Developer > Emerge2 Digital Inc., "evolving business to digital" > Web: http://www.emerge2.com Email: mike@emerge2.com >

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