In PHP, what are the different design patterns to implement OO controllers as opposed to procedural controllers?
Posted
by
Ryan
on Programmers
See other posts from Programmers
or by Ryan
Published on 2012-09-27T07:58:15Z
Indexed on
2012/09/27
9:50 UTC
Read the original article
Hit count: 246
For example, it's very straightforward to have an index.php controller be a procedural script like so:
<?php //include classes and functions //get some data from the database //and/or process a form submission //render HTML using your template system ?>
Then I can just navigate to http://mysite.com/index.php and the above procedural script is essentially acting as a simple controller. Here the controller mechanism is a basic procedural script.
How then do you make controllers classes instead of procedural scripts? Must the controller class always be tied to the routing mechanism?
© Programmers or respective owner