Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
Core extension not working
  • I'm trying to extend the Html core class. I have placed an html.php file in app/classes and I have tried using both the documented way of naming the class (MyHtml extends Html) and some I found online (e.g. Html extends Fuel\Html) but it does not work. My app consistently can not find the functions placed in the extended core class. Any ideas on what may be causing this? Thanks in advance
  • Did you registered your classes in the app/bootstrap.php file? Documentation here: http://fuelphp.com/docs/general/extending_core.html
  • No I hadn't, the way the documentation is written it looks like that is only neccessary when replacing core classes.
  • If the autoloader can't find it you didn't name the file right or didn't name the class right. - class MyHtml should be at "app/classes/myhtml.php" (fully lowercase path!) and may extend either Fuel/Core/Html or Html
    - class Html should be at "app/classes/html.php" and can only extend Fuel/Core/Html (as Html is the class itself), must be registered in the Autoloader And it's in the app folder thus no namespace declaration for either. Btw, the "My" prefix is just an example in docs and incredibly ugly. I'd never use that personally. Either extend the core and overwrite it or extend the core into a class of your own that has a name that describes why it's not just an extension.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion