MyBB Community Forums

Full Version: Plugins as folder, and not a single php file
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I am writing a plugin where I prefer to have multiple files than just a single php file.

I tried creating a folder in the plugins/ directory and putting the php files inside it but MyBB would not pick it. It won't show in the plugins page in admin CP.

So how do I exactly go about creating the putting a plugin in its own folder?

Thanks,
-Bunny.
See how the Google SEO plugin does it.

Basically you have a PHP file in the plugin folder (google_seo.php), and this file loads the necessary PHP files from the subfolder. It only loads the files that are actually required, for example all plugin administration related stuff (install, activate, creating settings, checking for problems, ...) is in google_seo/plugin.php and this is only loaded if the user is actually viewing the plugins page in the Admin CP. Also, specific files are only loaded if the feature is enabled in the settings, for example if the user didn't enable the sitemap feature, the plugin won't even load the google_seo/sitemap.php file.
Thanks. Why did it not strike me :-p