Re: [SMARTY] Re: Smarty's Smartest Practices
| From: | Jason Sweat | Date: | Thu, 20 Feb 2003 02:29:58 +0000 |
| Subject: | Re: [SMARTY] Re: Smarty's Smartest Practices | ||
| References: | 1 | Groups: | php.smarty.general |
| Request: | Send a blank email to php-smarty-general+get-7972@lists.php.net to get a copy of this message | ||
Hi Mike,
Lately I have been developing apps using a MVC approach. When the system
decide to display a view, it determines if the user requested a valid view
(or chooses a default view), finds a class associated with the view and
creates an instance of that class. The controller also creates an instance
of Smarty, assigns some global variables, then passes the smarty instance to
the newly instantiated view classes Render() method. The view class adds
it's own content, then displays based on it's template. Each classes
template looks like:
{include file="header.tpl"}
custom view stuff
{include file="footer.tpl"}
In header.tpl, I load the site config file with scope=global so that config
vars can be used in each view's templates. I open the html document, write
a title line, include my css and display and header js for the view. I then
open the body and write the site navigation into a div id="navigation" that
is positionally controlled using css and js. I close the nav div, and open
a div id=="main".
The footer.tpl closes the main div, and the document. If I had any js I
wanted to run at the end of a page, I would include it there as well.
Hope that helps for another perspective.
Jason
----- Original Message -----
From: "Mike van Lammeren" <mike@emerge2.com>
To: <smarty-general@lists.php.net>
Sent: Wednesday, February 19, 2003 11:42 AM
Subject: [SMARTY] Re: Smarty's Smartest Practices
> I think it's fair to say that everyone who responded so far is in
> agreement. Is there anyone that does things differently? Maybe something
> else works better for you?