Re: Architecture patterns in PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





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.

And how many architecture patterns are there?

please do try to avoid pandoras box on the list ;) It can result in 100+ post threads, heh. that being said patterns are pretty general things, that's why they're called patterns. most of the time various languages will result in slightly different concrete realizations of a pattern, but you'll find most of them rather simple to realize in php. One that really isn't well suited to phps build-up / tear-down paradigm is the state pattern. much easier in java or cpp, imo.

-nathan

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux