• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
The number of model, controller and view in the ci?

#1
[eluser]shinianyijian[/eluser]
Each view should be to create a controller and a model in the ci?If a method is a page in the controller, for example, my site has 10 pages, I created a 10 view, 10 model, and a controller.Ten functions(pages)in the controller, so don't create other controller, that right?I've never come into contact with MVC,How to match them?You usually do?Please tell me,thanks!

#2
[eluser]boltsabre[/eluser]
To answer your question, it all just depends on what you are trying to achieve, sometimes you have one single controller and all it does is load one page via its "index" function, other times one controller might have multiple functions, each of which loads a different view (as it seems from you comment is what you are doing).

You don't HAVE to have a model, only if you need to some kind of database/data related stuff. Different people utilise models differently, some have one model per DB table, others have one model per controller, and so on, CI is VERY flexible in this.

Quote:I’ve never come into contact with MVC,How to match them
http://codeigniter.com/tutorials/
http://ellislab.com/codeigniter/user-guide/

If I was you I'd go through some of the tutorials (and code them!!!) to get familiar with how CI / MVC platforms work. And don't forget to go through the user guide, it's great. Good luck.


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.