My $0.02 worth,

For the purposes of sanity (mine) I treat a combination of PHP/HTML in the
web page as the middle tier (Controller), the browser and any JavaScript as
the front-end (View) and a combination of PHP objects and the database as
the backend (Model).

This warped view of MVC allows me to incorporate some PHP in the HTML so I
can avoid things like tag libraries and template engines. (Nothing wrong
with them, they are just one MORE level of abstraction) As a rule, I do not
allow the code that is in my web page to access the database.  All database
access is done through objects. I also do not let objects (with 1 exception,
my FormBuilder class) generate HTML.

Depending on the project, I may code mysql_* commands in my objects or (my
preferred method) utilize ADODB as my database abstraction layer. (BTW, I
don't use it because I switch databases a lot, I use it because I like the
feature set.)

Therefore, my web pages usually:

Instantiate the objects necessary to build the page.
Manipulate the objects and wrap them in HTML.
Destroy the objects and send the page to the browser.

It's not true MVC or pure OOP but it's the best compromise I've come up
with.

=C=


*
* Cal Evans
* The Virtual CIO
* http://www.calevans.com
*


-----Original Message-----
From: Dave Smith [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, October 09, 2002 10:27 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] Separating content from style


Folks,

I've just learned a bit about Java Beans and how they are useful in
separating content from style. They let you do XSLT'ish stuff in your HTML
to grab data while not bogging down your HTML with database-related
function calls. I've heard this setup referred to as "templates" and
"3-tier". It has all kinds of advantages, the biggest of which
is probably the ability to specialize: Allow your web-designer
to work with HTML/CSS and your DBA to work with SQL, with no
overlap.

Obviously, PHP doesn't really lend itself to this sort of setup at first.
At least, I haven't found a good way to do it.

Does anyone have any good docs on how to setup a 3-tier templated system
in PHP that separates content from style? If not, how about a few words on
this idea? What are your thoughts? How can PHP tackle this problem?

advTHANKSance,
Dave


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to