CodeIgniter Forums
Project structure in MVC - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Project structure in MVC (/showthread.php?tid=58983)



Project structure in MVC - El Forum - 08-11-2013

[eluser]Unknown[/eluser]
Hi,

I am new to MVC and trying to convert existing project to MVC using codeignater. Below is the current project structure and the contents of it.

I wanted to know, which method go to which controller. A guidance would really help me here

index.php //contains links to students.php, professors.php, student_prof.php, admin/index.php
students.php //lists all students
professors.php //lists all professors
stud_prof.php //lists both students along with thier respective professors

admin
index.php //login page
students.php // add, edit, delete, list students
professors.php // add, edit, delete, list professors
logout.php //logout for admin


my try,

models
Students_model //add, edit, delete, list methods
Professors_model //add, edit, delete, list methods
Admin //login method

controllers
Index // show_links method
Students //add, edit, delete, list students methods
Professors //add, edit, delete, list professors methods
Admin //login, logout methods


Thanks


Project structure in MVC - El Forum - 08-14-2013

[eluser]RogerMore[/eluser]
Hey CodeLive,

Nothing wrong with your approach...

Just set the default controller to your index controller in application/config/routes.php like so and you're good to go:

Code:
$route['default_controller'] = 'index';

Roger


Project structure in MVC - El Forum - 08-15-2013

[eluser]Unknown[/eluser]
Thank you very much