RE: [SMARTY] best practice - combining script output

From: Date: Tue, 27 Aug 2002 14:54:04 +0000
Subject: RE: [SMARTY] best practice - combining script output
Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-5839@lists.php.net to get a copy of this message
Jason, Could you give some more explanation about your "boxes" solution? Maybe a small example? Would help a lot. Thx. Tom -----Oorspronkelijk bericht----- Van: Jason Sweat [mailto:sweatjejm@mchsi.com] Verzonden: zaterdag 24 augustus 2002 3:50 Aan: Greg Elisara; smarty-general@lists.php.net Onderwerp: Re: [SMARTY] best practice - combining script output 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 > -- Smarty General Mailing List (http://smarty.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

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