You are here: Re: [SMARTY] Seperation of Logic and Presentation « Smarty Templates Posts « IT news, forums, messages
Re: [SMARTY] Seperation of Logic and Presentation

Posted by Samuel Abels on 07/30/05 01:50

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация