Welcome Guest, Not a member yet? Register   Sign In
Need Help Modifying Core classes.
#1

[eluser]navetz[/eluser]
I previously posted this question here and got good feedback although I didn't fully understand what I was being told: http://ellislab.com/forums/viewthread/129723/

Now I have compiled enough information to know what I want code igniter to do, I'm just not sure it can do it without modifying the core.

I found a tutorial where the type of setup I want is created, the only problem is he skips over the modification of the core files where there work is done. (I have emailed him asking as well)

This is the tutorial: http://www.viddler.com/explore/elliothaughin/videos/9/

At 8:50 you can see the directory structure and see how he has his controllers set into a module folder. If you don't feel like opening the video it looks like this:

-application
-modules
-news
-controllers
-models
-views
-something else
-controllers
-models
-views

Now you can see the benefit to this right away. You can take any loosely coupled module and plug it into another system easily.

The problem with this is I don't know how to set up the routes. I still need it to work the same way as if all my controllers were in the same directory. The author of the video Elliot Haughin has it working very elegantly. He mentions he changed the library files: routes.php and loader.php and put the changed files in the applications directory.

The core file he needed to edit was CodeIgniter.php

I don't know what any of the changes were. I am off to try and make this work myself. If anyone knows how to do this or a tutorial of how to do this I would greatly appreciate it. Also if I am mistaken about anything please let me know because I am new to codeigniter and want to learn.
#2

[eluser]bretticus[/eluser]
Perhaps he is using some module extension of CI. You might be interest in CI HMVC or Matchbox.
#3

[eluser]navetz[/eluser]
I LOVE THIS FORUM! haha thanks a lot for the info Big GrinBig GrinBig GrinBig Grin
#4

[eluser]bretticus[/eluser]
I finally understand what you mean by loose coupling after watching Elliot's video. Yes, it's certainly an attractive prospect to copy a folder with the controller and views together. Again, I would put a lot of that logic in a library to reuse it. Simply because I like the abstraction of instantiating a class that I can alter accordingly. I feel that model of development is even more modular, but I digress. Smile

Things to note about the video. He is using an old versuion of CI (old video I pressume.) Seems to be relatively the same though.

Instead of altering the core files, he could have easily extended those core classes in his application folder. The caveat is that MY_Loader.php and MY_routes.php also need to be copied into another application with the module folder. However, this makes the core very easy to upgrade because from that point on, you do not need to edit those files each time you download and unzip the core files.

See Extending Core Class.

Enjoy.




Theme © iAndrew 2016 - Forum software by © MyBB