PHP MVC - How to create?

I am relatively good at website development. I mainly use LAMP, where I already have a small "wireframe" that I use. In short, it separates the logic from the layout, and I have basically one logical file for one or more layout files depending on which views are supported in the layout. There is an administrator section and there is a user auth and all such things. Good.

So, when you are trying to get more detailed information about my way of designing / programming in PHP - or programming on the website as a whole - I wonder how to think MVC correctly. I am leaning towards this path, since my current structure is very database oriented and has become somewhat difficult when performance matters.

So, here is my question: Do I correctly assume that the controller usually corresponds to the “section” or “page”, and the view takes care of displaying this controller and that the model processes the objects used by the controller and displayed in the views?

Take an example (not too complicated, but enough to check if my thinking is really):

Say we have a simple website for games. Sections would typically be: frontpage, games, forums, and o / disclaimer, etc.

Controller Classes correspond to sections, but become more complex in order to encompass the version of the "single instance" of an object covered by the ie section, the game section becomes two controllers; one for reviewing games (list of games) and one for the game page itself. Everything will be something like a frontpage, game review, game page, forums, forum, topic page, disclaimer and disclaimer.

views can be multiple layouts for each controller, for example. the same as the controllers, but possibly different types of views on the pages of forums (depending on how you want to view them) and game pages (possibly with high resolution), etc.

( dataobjects) - , , , , , , , , , , , .. ..

"" M-V-C -.

CodeIgniter - ( ), DB , 70 000 .

, , MVC , , , , MVC ( ).

+5
3

, php , , MVC -. , MVC -, .

, MVC, SO . , .

, , .

  • , .
  • ,
  • ,

, , gameoverview , , indexcontroller, . gameoverview .., ControlController .

Zend Framework . , , .

+3

CodeIgniter - MVC, net.tutsplus.com CodeIgniter

, CI, :

CI , , , Symfony Yii

+1

, , , ,

(, , ... , ).

.

- .

, . . , POST . , .

. http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller#Description .

, , . , , ( ) , .

- . .

- .

, .

EDIT: As others have pointed out, a number of MVC frameworks already exist. (See http://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller#PHP for a list), and I would advise you not to be too attached to the structure you have already created, if there is another does the job better.

0
source

All Articles