Jump to content

best way to allow plugins?


blueman378

Recommended Posts

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

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.

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

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.