Welcome Guest, Not a member yet? Register   Sign In
Splitting one controller into multiple files

Is there a way to split a single controller into multiple files?

I would like to start splitting a particular controller I'm working with into smaller pieces because it's starting to become rather large.

Here is an example of what I would like to achieve:

I have two urls:


These urls relate to the same controller 'junk'. But what I would like to do is be able to split the controller into two files so that foo and bar are not in the same file.

Does anyone know if this is even possible? or, is this the wrong way to go about it and large controllers are normal?

[eluser]Mark Skilbeck[/eluser]
Most languages acheive this with 'namespaces', although I don't think it's implemented in PHP or CI yet.

ya, just do it.

We had a controller here recently that actually split into 4 other controllers to help speed up the system. Splitting up un-related functionality among controllers makes your system faster.

Take a blog
1) view controller
2) CRUD controller
3) Archive controller
4) etc...

You could put all that in one huge view - but then you would have a HUGE file to load on each request.

But how do you do it within one url? How do you load the extra functions? Do you have any code examples?



interesting... Cool, thanks for the help.

Theme © iAndrew 2016 - Forum software by © MyBB