Re: [SMARTY] Seperation of Logic and Presentation

Samuel Abels <[email protected]>
Newsgroups gmane.comp.php.smarty.general
Message-ID <1122677455.12480.16.camel@chef>
On Fr, 2005-07-29 at 13:49 -0400, Evan Wagner wrote:
> I've been using Smarty for a couple years now. Recently I've
> questioned my method of separating Logic and Presentation and have
> come up with two ways to solve it.
> 
> [...]
> 
> What do you guys think?

Originally coming from desktop application programming I only recently
started developing web applications, so just had to figure that out for
myself. I played around with Smarty and tried a view different models,
now this works quite fine:

1. Database abstraction in PHP (using AdoDB in my particular case).
> http://cvs.gna.org/viewcvs/tefinch/tefinch/src/services/forumdb.class.php?rev=1.6&content-type=text/vnd.viewcvs-markup

2. Abstract every Smarty template through a class that does all of the
logic.
http://cvs.gna.org/viewcvs/tefinch/tefinch/src/actions/

3. Keep the templates dumb. They are basically only doing the formating.
http://cvs.gna.org/viewcvs/tefinch/tefinch/src/themes/heise2/

4. A controller.
> http://cvs.gna.org/viewcvs/tefinch/tefinch/src/forum.inc.php?rev=1.44&content-type=text/vnd.viewcvs-markup

I did not want to drag the SQL into the templates as this might expose
too much of the implementation already, thus blurring the separation.

I am fairly happy with the result so far.

-Samuel

-- 
Smarty General Mailing List (http://smarty.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.