random1 Posted December 8, 2009 Share Posted December 8, 2009 I have created my own CMS from the ground up with heaps of great features I'd like to implement an "Addons" or "Plugins" feature so that the administrator can enable/disable and customize an "Addon" to suit their website. For example an "Addon" called "EzyBasket" could be created that changes the appearence of the shopping basket to be columns instead of rows.. etc.. Anyone have a good way of implementing 'addon' logic into an app. It's best of it's at a low level include? Quote Link to comment https://forums.phpfreaks.com/topic/184344-implementing-an-addonsplugins-feature/ Share on other sites More sharing options...
Altec Posted December 8, 2009 Share Posted December 8, 2009 Use a hook system. Have a class that is called in key areas of the script execution that runs "hooked" functions. For example, you could do: $plugins->hook('hook_name','function_name'); And have something like: $plugins->run('hook_name'); Quote Link to comment https://forums.phpfreaks.com/topic/184344-implementing-an-addonsplugins-feature/#findComment-973226 Share on other sites More sharing options...
Daniel0 Posted December 8, 2009 Share Posted December 8, 2009 For more formal descriptions of what Altec is proposing, have a look at the observer pattern. Quote Link to comment https://forums.phpfreaks.com/topic/184344-implementing-an-addonsplugins-feature/#findComment-973396 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.