What's the best way to overwrite the show_error() function in Common.php?

That's the best way to overwrite anything in a framework.
In CodeIgnitor just extend the base class and put it in the appropriate folder.
CodeIgnitor has empty Library , helper etc... folders. Simply extend the class you want and put it in those empty folders.

I think Common.php cannot be extended as the other core files because it is statically loaded by /system/core/CodeIgniter.php:

 /*
 * ------------------------------------------------------
 *  Load the global functions
 * ------------------------------------------------------
 */
    require(BASEPATH.'core/Common.php');

Before checking system/core/CodeIgniter.php, I've also tried to overwrite that function through hooks, but obviously it doesn't work, even setting pre_system because it's loaded right after that require() call and because it's loaded exactly by system/core/Common.php.

So a part a direct edit, I agree with the solution provided by diafol, i.e. extending Exceptions library, although I'm not sure it's exactly what you want.

I gave up and just made a hard-coded quick change to the file. My change was so small it wasn't even worth including an additional file or doing significantly more processing work.

Why so CI aren't you intelligent enough to build you own framework ? Frameworks are conventions CI has many problems in logic an in OOP as we all know … I really can’t understand why somebody that has a high programming IQ would use that

Member Avatar for diafol

ouch!

I am using CI because it's super lightweight (a biggie), I find most of its built-in functions useful so I'm not reinventing the wheel as much as I'd otherwise have to, and it's my first delve into MVC, and I read it was a good beginning-MVC framework.

Member Avatar for diafol

I found CI gave me even more bad habits as it didn't stick rigidly enough to MVC. The model is pretty much optional. That really messed me up when trying to figure out other frameworks like Yii and Symfony2 - well less said about S2 the better - my nose is still bleeding 2 years later on :)

I agree with re-inventing the wheel bit. I think jkon that you've developed your own? but I can imagine that it would take a ridiculous amount of time - especially for somebody not versed in MVC, IQ notwithstanding.

Thing is though, wrt CI, if it works and is easy-ish to implement, why not? I really don't see the point of struggling with a specification-rigid framework that's a bitch to get to work. DW was built from the ground up in a very short space of time (I think) and it works - fact. OK - it may not be perfect - but for the most part, the user interaction is silky compared to the clunkiness of off-the-peg forum software. I'm definitely a fan. If this is the mess that CI makes of things, well it's not bad is it? :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.