Welcome Guest, Not a member yet? Register   Sign In
MVC structural advice - separation of code
#1

[eluser]Lyon[/eluser]
Hi all,

I am new to both codeigniter and the mvc approach to programming and am looking for some guidance on structuring my code. I have read up on the model view controller structure but I am having problems translating what should go where into my own project.

I am creating a small website that will contain my blog, and my portfolio work.

At the moment I have an admin section that manages both.
The admin controller contains the functionality to add a new project, edit an existing project, add a new post to the blog, and edit an existing blog post.

The edit_project_view displays multiple forms on one page, each form covering a different aspect of the project. For example I have a edit name form, edit description, add screenshot, delete screenshot, add video, delete video, edit user guide, edit technologies used in the project etc... all in their own form.

The edit_project function is the biggest function I have. This function is responsible for setting the form validation rules depending on which form has been posted, it is also responsible for passing the information along to the admin_model which is responsible for talking to the database.

Upon a form like add screenshot being posted the function uses the image_lib to watermark and thumbnail the image then pass the filenames along to the admin_model which enters them into the database.


This function is becomming really big and feels poorly structured. I really feel like I need some extra abstraction here.
I think I need to separate the blog and portfolio admin stuff into their own controllers.
I think I might also benefit from a helper somewhere to maybe deal with stuff like processing the images, or entering the data into the database.

I just need help with the structure, like what controllers, models, and helpers should I be using, and what should each one of them contain.
I am not looking for code, just simple comments such as use x controller to do y, and x helper should give the functionality to do z.

If any more information is required (or code posted) please just let me know and I'll try to post it as soon as possible.
Any help/advice would be greatly appreciated.
Thanks in advance!


Messages In This Thread
MVC structural advice - separation of code - by El Forum - 06-15-2010, 02:31 PM
MVC structural advice - separation of code - by El Forum - 06-15-2010, 06:07 PM
MVC structural advice - separation of code - by El Forum - 06-16-2010, 07:32 AM
MVC structural advice - separation of code - by El Forum - 06-16-2010, 07:37 AM
MVC structural advice - separation of code - by El Forum - 06-16-2010, 09:11 AM
MVC structural advice - separation of code - by El Forum - 06-16-2010, 03:00 PM
MVC structural advice - separation of code - by El Forum - 06-16-2010, 03:07 PM
MVC structural advice - separation of code - by El Forum - 07-22-2010, 06:09 AM
MVC structural advice - separation of code - by El Forum - 07-22-2010, 06:24 AM
MVC structural advice - separation of code - by El Forum - 07-22-2010, 09:29 AM
MVC structural advice - separation of code - by El Forum - 07-22-2010, 11:05 AM
MVC structural advice - separation of code - by El Forum - 07-22-2010, 11:09 AM
MVC structural advice - separation of code - by El Forum - 07-22-2010, 11:16 AM
MVC structural advice - separation of code - by El Forum - 07-22-2010, 11:25 AM
MVC structural advice - separation of code - by El Forum - 07-22-2010, 11:51 AM
MVC structural advice - separation of code - by El Forum - 07-22-2010, 12:25 PM
MVC structural advice - separation of code - by El Forum - 07-22-2010, 12:55 PM
MVC structural advice - separation of code - by El Forum - 07-22-2010, 01:03 PM
MVC structural advice - separation of code - by El Forum - 07-22-2010, 01:29 PM
MVC structural advice - separation of code - by El Forum - 07-22-2010, 01:50 PM
MVC structural advice - separation of code - by El Forum - 07-22-2010, 02:29 PM
MVC structural advice - separation of code - by El Forum - 07-01-2012, 09:30 AM



Theme © iAndrew 2016 - Forum software by © MyBB