Guldstrand Posted February 27, 2009 Share Posted February 27, 2009 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 More sharing options...
rhodesa Posted February 27, 2009 Share Posted February 27, 2009 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? Link to comment https://forums.phpfreaks.com/topic/147149-build-a-simple-plugins-hooks-system/#findComment-772502 Share on other sites More sharing options...
Guldstrand Posted February 27, 2009 Author Share Posted February 27, 2009 Yes, it make lots of sense. Altho.. i was hoping for some "exampel code" to get me started. Link to comment https://forums.phpfreaks.com/topic/147149-build-a-simple-plugins-hooks-system/#findComment-772508 Share on other sites More sharing options...
rhodesa Posted February 27, 2009 Share Posted February 27, 2009 the autoloader had example code on the site. the second option is a pretty big undertaking. my 'idea' was stolen from http://www.cmsmadesimple.org/ if you want to check it out though Link to comment https://forums.phpfreaks.com/topic/147149-build-a-simple-plugins-hooks-system/#findComment-772516 Share on other sites More sharing options...
Guldstrand Posted February 27, 2009 Author Share Posted February 27, 2009 the autoloader had example code on the site. the second option is a pretty big undertaking. my 'idea' was stolen from http://www.cmsmadesimple.org/ if you want to check it out though What do you mean by "undertaking"? Link to comment https://forums.phpfreaks.com/topic/147149-build-a-simple-plugins-hooks-system/#findComment-772521 Share on other sites More sharing options...
rhodesa Posted February 27, 2009 Share Posted February 27, 2009 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 Link to comment https://forums.phpfreaks.com/topic/147149-build-a-simple-plugins-hooks-system/#findComment-772531 Share on other sites More sharing options...
Guldstrand Posted February 27, 2009 Author Share Posted February 27, 2009 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. Link to comment https://forums.phpfreaks.com/topic/147149-build-a-simple-plugins-hooks-system/#findComment-772535 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.