alexandanthony Posted January 21, 2010 Share Posted January 21, 2010 I helped develope the website powering platform Alex! TestBlog alextestblog.sourceforge.net and i need a system for plugins does anyone know how i'd do this? it needs to be able to identify a plugin by a name and description? Quote Link to comment Share on other sites More sharing options...
teamatomic Posted January 21, 2010 Share Posted January 21, 2010 I guess that it depends on how the plugins work. Do they need to be installed and registered? Can they just be dropped into a plugin folder? It would help to know how they have to be built to work with the framework. HTH Teamatomic Quote Link to comment Share on other sites More sharing options...
alexandanthony Posted January 21, 2010 Author Share Posted January 21, 2010 all they need to do is just drop the plugin in the plugins/ folder and then it works but i can;t figure out how to do this Quote Link to comment Share on other sites More sharing options...
teamatomic Posted January 21, 2010 Share Posted January 21, 2010 You need to scandir the plugin folder. You then file_get_contents on a desc file in each folder. The desc file can contain the proper plugin name,description,version,author,contact,etc. You can additionally preface a plugin folder with a _ if you want to disable it. Fairly easy to implement. That way you can disable a plugin if an automatic upgrade will break it. HTH Teamatomic Quote Link to comment Share on other sites More sharing options...
gizmola Posted January 21, 2010 Share Posted January 21, 2010 You might have a look at the sourcecode for the serendipity blog. It provides this type of functionality. Often what will happen is that the admin system will provide a function that looks through the plugins directory for new plugin directories, comparing the structure against a table of currently installed plugins. There's a lot to this, so I really don't want to say too much more about it, as a book could be written on the subject. Many systems also see value in having a manifest file that provides configuration info, as per the suggesion from teamatomic. This file might also specify the list of files, and sometimes even a hash so that the system can determine if the plugin is complete and valid. Often plugins have install and uninstall scripts that set up a newly installed plugin for the first time, or allow the system to remove the plugin and clean up after itself. I'm afraid you'll have to be a lot more specific about what your objectives are. Quote Link to comment Share on other sites More sharing options...
alexandanthony Posted January 21, 2010 Author Share Posted January 21, 2010 how would i get_file_contents every file in the plugin directory? Quote Link to comment Share on other sites More sharing options...
teamatomic Posted January 21, 2010 Share Posted January 21, 2010 Learn how to use the php manual. The boiler plate code in it will do exactly what you want to accomplish. opendir readdir closedir or scandir foreach file_get_contents HTH Teamatomic Quote Link to comment Share on other sites More sharing options...
alexandanthony Posted January 21, 2010 Author Share Posted January 21, 2010 im gonna talk with my brother and wait a few versions before introducing plugins so more development can take place Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.