Jump to content

Build a simple plugins-/hooks system?


Guldstrand

Recommended Posts

I´m working on a back-end for band sites that´s goin to be released to public.

 

Right now i have lots of functions in a file plugins.class.php.

(All functions can easily be integrated to any website with php.)

 

Now to my question: what´s the easiest way to work with plugins/hooks?

I mean if i want to create and release a new plugin in the future, i want the end-user to just upload the new plugin to a directory called "/plugins" and then just "activate" it.

 

I´m not THAT good at php, so i hope that someone could post some exampel code or links to guides/tutorials.

 

Thanks in advance!

Link to comment
https://forums.phpfreaks.com/topic/147149-build-a-simple-plugins-hooks-system/
Share on other sites

Check out PHP's __autoload() function:

http://us.php.net/autoload

 

if that isn't what you are looking for, you may want to just have a function that loops over the files in a folder. be careful with this though, as you don't want to do this every page load. create an admin panel for managing plugins. have this page loop over the folder and show each plugin. then have a button for each to 'install' it. once installed, add the plugin name and path to a list somewhere (like in a mysql table). then, on the site, you can get a list of installed plugins from that table. make sense?

it's not just a basic block of code. there would be designing/coding an admin panel to manage the plugins, mysql queries to INSERT/UPDATE/SELECT plugins, etc.

 

basically i'm saying it's not something simple i can whip up for you in the post

it's not just a basic block of code. there would be designing/coding an admin panel to manage the plugins, mysql queries to INSERT/UPDATE/SELECT plugins, etc.

 

basically i'm saying it's not something simple i can whip up for you in the post

I know that.

I didn´t mean that you should code the whole thing, only a few pointers for the different sections would be great.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.