Re: [SMARTY] Seperation of Logic and Presentation

From: Date: Fri, 29 Jul 2005 22:50:54 +0000
Subject: Re: [SMARTY] Seperation of Logic and Presentation
References: 1  Groups: php.smarty.general 
Request: Send a blank email to php-smarty-general+get-12905@lists.php.net to get a copy of this message
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

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