We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

extending another module

Development and Programming

Jayson Ng's avatar
Jayson Ng
67 posts
15 years ago
Jayson Ng's avatar Jayson Ng

so I have 2 classes I’m converting into modules. 1 is a child of the other.

however, when I converted the classes I have into an EE module, I get an error saying that the parent class cannot be found. basically it hasn’t been loaded.

Now if it were a straight PHP script, I would load the parent 1st then the child class. But in EE, is there a way to do this via the modules / third party add-ons?

thanks, Jayson

       
Bjørn Børresen's avatar
Bjørn Børresen
629 posts
15 years ago
Bjørn Børresen's avatar Bjørn Børresen

This should work:

require PATH_THIRD.'your_module_name/my_class_name.php';
$my_class = new my_class_name()
       
Bjørn Børresen's avatar
Bjørn Børresen
629 posts
15 years ago
Bjørn Børresen's avatar Bjørn Børresen

ah, I was thinking wrong .. no sorry I don’t know of a good way to do that in EE. I guess you could load the class before the module definition but that would be hacky.

       
Jayson Ng's avatar
Jayson Ng
67 posts
15 years ago
Jayson Ng's avatar Jayson Ng

hi Bjorn!

thanks for the tip will try it out.

😊

edit: hehe didn’t see your second comment. ah well. anyone else? mods?

       
Jayson Ng's avatar
Jayson Ng
67 posts
15 years ago
Jayson Ng's avatar Jayson Ng

@bjorn

I’m kinda hacking my way through this project of mine. I have codeigniter site I’m moving to EE. 😊 aaargh.

       
Jayson Ng's avatar
Jayson Ng
67 posts
15 years ago
Jayson Ng's avatar Jayson Ng

What about extensions? is it really only to extend Core modules or will it work on extending third party modules? I really havnt looked into extensions that much. 😊

       
Bjørn Børresen's avatar
Bjørn Børresen
629 posts
15 years ago
Bjørn Børresen's avatar Bjørn Børresen

Extensions are not what you’d consider “extending” per se, but they call “hooks” - read up on that in the docs: http://expressionengine.com/public_beta/docs/development/index.html

So it’s not about extending any classes. It’s about “extending” EE functionality by changing how stuff works via hooks.

       
Jayson Ng's avatar
Jayson Ng
67 posts
15 years ago
Jayson Ng's avatar Jayson Ng

hmm… that’s right. I think i read that about extending. thanks for the info. 😊

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.