RE: [SMARTY] Smarty's Smartest Practices?
| From: | Ruslan Savchyshyn | Date: | Wed, 19 Feb 2003 21:56:11 +0000 |
| Subject: | RE: [SMARTY] Smarty's Smartest Practices? | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-7943@lists.php.net to get a copy of this message | ||
I'm using this approach also.
> Template contains:
> {include file=$template}
Second one seems to be "old-styled" approach as it have been used in
phplib templates and own template engines.
---------------
Ruslan Savchyshyn
http://www.MagneticOne.com/
Web development and design services
-----Original Message-----
From: Monte Ohrt [mailto:monte@ispi.net]
Sent: Wednesday, February 19, 2003 11:40 PM
To: Paul Lockaby
Cc: Smarty General
Subject: Re: [SMARTY] Smarty's Smartest Practices?
The first one would be more efficient because it doesn't use output
buffering, thus it doesn't collect the template output into memory.
ALso, the include is managed within the template, not by the
application.
Monte
On Wed, 2003-02-19 at 15:34, Paul Lockaby wrote:
> Hi,
>
> After reading this whole thread, I decided to completely change how I
> worked with my templates in regards to "header" and "footer"
templates.
> However, when inserting the "content" what is the advantage of
> specifying a template variable containing the name of the template to
be
> included, versus fetching the template in php and passing the
resulting
> template? For example:
>
> PHP script contains:
> $smarty->assign("template","news.tpl");
> $smarty->display("index.tpl");
>
> Template contains:
> {include file=$template}
>
> ... versus ...
>
> PHP script contains:
> $template = $smarty->fetch("news.tpl");
> $smarty->assign("content",$template);
> $smarty->display("index.tpl");
>
> Template contains:
> {$content}
>
> Which one do you guys tend to use and for what reasons?
>
> ~Paul
>
> Mike van Lammeren wrote:
> > 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
> >
> >
>
>
> --
> Paul Lockaby
> paul@paullockaby.com
> http://www.paullockaby.com
--
Monte Ohrt <monte@ispi.net>
--
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php