Nathan Nobbe wrote:
Hey,
How do you structure your web applications? I am thinking in terms of
separating presentation and logic. How is that done in PHP?
mvc is pretty popular, but php is so flexible you often don't need it
for smaller applications.
For example, if you take a page-controller approach, a php app is dead
simple. You have a seperate entery point for evrything; login.php,
register.php, etc could be considered controllers, then all your common
logic comes in via some includes, hopefully files outside the webroot.
then you have some template directory w/ files that are a mixture of php
and html(for example). your 'controller' files include the library
code, hit the db (if necc.) and then stuff data into the templates for
output.
if you want to see an exmple if a more traditional mvc there are scads
of open source frameworks out there which use a front controller
approach. Code igniter is really straight forward, you can probly learn
quickly from it.
Thanks for the reply.
Does anyone know of a good written guide about patterns like Front
controller, Page Controller, MVC etc. and how they are implemented in PHP?
I found something about these patterns in a guide on MSDN called
Enterprise Solution Patterns Using Microsoft .NET
(http://msdn.microsoft.com/library/ms998516(en-us).aspx).
It describes MVC, Page Controller, Front Controller and a lot of other
patterns for ASP.NET applications.
Something like this for PHP would be cool.
Thanks
Michael C. Yates
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php