blueman378 Posted November 4, 2008 Share Posted November 4, 2008 Hi guys, im building a forum and its going really well, however before i get too deep in a was wondering what would the best way be to allow plugins in the forum? i had the general idea of simply having a folder called plugins and using this: <?php if ($handle = opendir('plugins/')) { echo "<!--INCLUDED PLUGINS:-->\n"; while (false !== ($file = readdir($handle))) { if($file != "." && $file != "..") { echo "<!--$file-->\n"; include_once("plugins/$file"); } } closedir($handle); } ?> but i think there is a better way? as this would be very hard to add any real kind of formatting to it and it would have to be simply functional plugins. im basing the theming around smarty any ideas on a better way? Link to comment https://forums.phpfreaks.com/topic/131322-best-way-to-allow-plugins/ Share on other sites More sharing options...
rhodesa Posted November 4, 2008 Share Posted November 4, 2008 reading files in a directory, in my experience, can heavily slow down your website. usually what i see, is a 'Plugin Manager' screen in the admin panel. When that page is hit, it will parse the folder for all the plugins in it. Then, give the admin the ability to enable/disable them. The ones that are enabled, store the paths into a db table. That way, when your frontend goes to load the plugins, it knows all the paths already and doesn't have to read the directory. Link to comment https://forums.phpfreaks.com/topic/131322-best-way-to-allow-plugins/#findComment-682008 Share on other sites More sharing options...
blueman378 Posted November 4, 2008 Author Share Posted November 4, 2008 cheers. Will do that, never thought of doing it that way. but what would you suggest for making them more useable? im looking at possibly having a section defined as eg sidebar() and that will load in all side bar plugins. same for other areas of the site? good idea or rubbish? matt Link to comment https://forums.phpfreaks.com/topic/131322-best-way-to-allow-plugins/#findComment-682462 Share on other sites More sharing options...
rhodesa Posted November 4, 2008 Share Posted November 4, 2008 i like Joomla's way...where you load a plugin. then the admin can create an instance of that plugin and define where it goes (left, right, top, bottom, etc) Link to comment https://forums.phpfreaks.com/topic/131322-best-way-to-allow-plugins/#findComment-682548 Share on other sites More sharing options...
blueman378 Posted November 5, 2008 Author Share Posted November 5, 2008 interesting. i think thats what i might do except more segregated so the developer names it eg Type_Page_Place_Name.plg eg Plugin_All_Sidebar_Radio.plg Plugin_All_Menu_Msnuser.plg Plugin_Posts_Posterdetails.plg good bad? Link to comment https://forums.phpfreaks.com/topic/131322-best-way-to-allow-plugins/#findComment-682569 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.