Welcome Guest, Not a member yet? Register   Sign In
Using MVC
#2

[eluser]Sector[/eluser]
This is perhaps not such a direct reply but here goes:

Sometimes when you port sites to CI, you'll have classes that don't exactly fit, or worse, can't be transformed into MVC pattern without a crapload of work and violation of the Don't Repeat Yourself rule. I put these things into the application/libraries folder and autoload them. Works wonders.

For example, I had a class calledd Api that contained about 40 methods all concerning database queries (f. example: getProject($id), deleteProject($id), ...)

Instead of trying to forge it into models, I just renamed the class to Data and put it in my libraries. Works without having to change a thing in the code. Now I just call $this->data->getProject($id). You'll have to load the database class before the Data class though, in the autoload array Smile.

Hope that gives a little insight. (it all depends on the magnitude of what you are trying to port, ofcourse)


Messages In This Thread
Using MVC - by El Forum - 08-21-2007, 02:38 AM
Using MVC - by El Forum - 08-21-2007, 02:53 AM
Using MVC - by El Forum - 08-21-2007, 03:05 AM
Using MVC - by El Forum - 08-21-2007, 04:14 AM
Using MVC - by El Forum - 08-21-2007, 08:18 AM
Using MVC - by El Forum - 08-21-2007, 09:21 AM



Theme © iAndrew 2016 - Forum software by © MyBB