CodeIgniter Forums
Elliot Haughins third screencast - 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: Elliot Haughins third screencast (/showthread.php?tid=4381)



Elliot Haughins third screencast - El Forum - 11-21-2007

[eluser]getbackwards[/eluser]
Hi I was wondering if anyone can help me. I am trying to do Elliot Haughin's third screen cast but have run into some problems. In the screencast, Elliot tells us that he has made changes to the Loader.php and Router.php files (which he takes from application/system/libraries/ and puts into applications/libraries/) and to the CodeIgniter.php file (application/system/codigniter/).

He says he makes them core files or something, I am not too sure as I don't know what I am doing. I have tried to complete the screen cast regardless but am getting these errors:

Quote:A PHP Error was encountered

Severity: Warning

Message: include(application/controllers/news.php) [function.include]: failed to open stream: No such file or directory

Filename: codeigniter/CodeIgniter.php

Line Number: 135
A PHP Error was encountered

Severity: Warning

Message: include() [function.include]: Failed opening 'application/controllers/news.php' for inclusion (include_path='.;C:\smarty\libs')

Filename: codeigniter/CodeIgniter.php

Line Number: 135
An Error Was Encountered

Unable to load your default controller. Please make sure the controller specified in your Routes.php file is valid.

Could someone tell me how I have to change these files to get the screen cast to work or put the files up for me.

At one stage I think Elliot was hosting them at his site but I haven't been able to find them on there anymore and I have tried looking at http://www.filepanda.com but that site doesn't seem to be going at the moment.

Any help much appreciated, ciao


Elliot Haughins third screencast - El Forum - 11-21-2007

[eluser]esra[/eluser]
Most of the CodeIgniter librares can be extended (subclassed) by creating a new library file with the MY_ filename prefix (note that MY_ can be changed to something else in config.php). When extending a library, only the methods in the original library that need to be changed (overloaded) are included in the extended library. You should have files called MY_Loader.php and MY_Router.php in application/libraries/. The user guide includes a good discusion on extending CodeIgniter.

CI checks to see if a library file with a MY_ prefix exists in application/libraries before loading a library from system/libraries/. If the MY_ file exists, CI automatically loads it instead of the parent library. The extended library inheirits all of the methods that were not overloaded from the parent library. This is called inhieritance.

------
Elliot and Zacharias were both working on methods of using modules within the CI framework. Zacharias' approach is called Modular Separation. There is a wiki article and a long thread. Modular Separation has excellent support from the author. You might find it easier to use Modular Separation to create the same CMS-like infrastructure.


Elliot Haughins third screencast - El Forum - 11-21-2007

[eluser]getbackwards[/eluser]
Thanks esra

I tried prefixing my files in application/libraries with MY_ (which is what is in the config.php) but am now getting this message:

Quote:Fatal error: Cannot redeclare class CI_Router in D:\xampplite\htdocs\dev\application\libraries\MY_Router.php on line 29

I think I actually need to make some changes to the code inside these files themselves.

I'm not having much luck with it, I think I'll check out Zacharias Modular Separation like you suggested and see if I get anymore joy with that, ta.