Re: [SMARTY] best practice - combining script output
| From: | Jason Sweat | Date: | Sat, 24 Aug 2002 01:49:58 +0000 |
| Subject: | Re: [SMARTY] best practice - combining script output | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-5821@lists.php.net to get a copy of this message | ||
Hi Greg,
This may or may not suit your purposes, but I often use "boxes" for layout.
Each of my "boxes" has a title, content, layout and comments.
I make a function build_box that returns an associative array of ['title'],
['content'], ['layout'], ['comments']...
Inside of this function, I generally use Smarty with caching enabled to
populate the content of each box.
The main script looks like:
$boxes[] = build_box(parms for box 1);
$boxes[] = build_box(parms for box 2);
...
$boxes[] = build_box(parms for box n);
then I assign this array to my Smarty object, disable caching and use a
layout template that knows how to deal with the layout parameter and all of
the title, content, etc.
YMMV
Jason
----- Original Message -----
From: "Greg Elisara" <greg@dreamlabs.co.nz>
To: <smarty-general@lists.php.net>
Sent: Friday, August 23, 2002 7:44 PM
Subject: [SMARTY] best practice - combining script output
> hi, what is the best practice for combining the content of several scripts
> of output to one template? - e.g. homepage is setup with header and footer
> (generally just templates), main content split into 3 columns and all
comes
> from a database - column 1 has navigation stuff, column 2 has main
content,
> and column 2 has associated content.
>
> i was considering writing separate php scripts with templates for each
> section of the main content e.g. nav.php (uses nav.tpl), stuff.php (uses
> stuff.tpl), assoc_stuff.php (uses assoc_stuff.tpl), and then combining
them
> into an overall wrapper for the page using include() in the wrapper.php
> file.
>
> however, i am pretty new to this stuff, especially smarty, and i would
like
> to get some feedback on what best practices are (i see there are
> include_php() and include() functions for smarty too).
>
> many thx. greg.
>
>
> --
> Smarty General Mailing List (http://smarty.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>