I’m creating my own script using the CodeIgniter MVC framework. Now, i want users to easily modify the site functionality and adding their own without modifying the code which i’ve already written.
How do i make my site pluginable ?
EDIT: The users would be the site admins. Not the end user. Basically just like drupal or joomla. Want the admin to be able to create/add plugins to extend site functionality.
There may be a better way that’s specific to CodeIgniter, but this is what I would do:
First, create functions for various “hook points” in your code. Say, a function named
PreArticlethat you call in your code, before an article is displayed.Allow the user to write code like this:
addHook_PreArticleis a function you’ve defined, which would add the passed string to some internal list. Then when thePreArticlefunction is called, each of those functions are executed, passing in any appropriate parameters that you define.