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

calling plugin functions from inside an extension

Development and Programming

James Smith's avatar
James Smith
259 posts
15 years ago
James Smith's avatar James Smith

Hiya,

In EE 1, Can anyone help show me how, if it’s even possible, to call a plugin’s method from within an extension’s method? … don’t really want to duplicate all my plugin’s code again inside the extension.

J

       
the3mus1can's avatar
the3mus1can
426 posts
15 years ago
the3mus1can's avatar the3mus1can

Try something like this in your extension:

if (!class_exists('Plugin_name'))
{
    include_once PATH_PI.'pi.plugin_name.php';
}

$PI = new Plugin_name;

$return_value = $PI->your_method('argument1', 'argument3');

Depending on what you need you could also create a super class that you plugin class and extension class both inherit from.

       
James Smith's avatar
James Smith
259 posts
15 years ago
James Smith's avatar James Smith

perfect, just what I was looking for, thanks!

       

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.