Jump to content

Plugin System


spudz

Recommended Posts

Hi,

I was just wondering if anyone could point me in the direction of some articles or books about creating a plugin system with php or if anyone has completed a system and would be willing to share how they did it and give me an idea of the code, design etc involved.

Thanks
Link to comment
Share on other sites

Sorry, I have a blog system that I'm working on for my clients (why not use one of the myriad of other blog systems? my clients are not tech savvy in any way, the system needs to be usable by a monkey). In this blog system I will have all the basic features of a blog, (ie. articles, comments, search, rss, tags, archives etc). However some clients will want extra functionality, I want to be able to add this functionality quickly and easily.

What I'd like to know is the easiest way to do this, I don't want to get too complicated Ii just want a simple 'Plugin' find, recognize and use system. Is there any articles, books or people that can educate me on this?
Link to comment
Share on other sites

We have a system where we create a template called "fred.html", and a script called "fred.php" containing the function "fred()".  That function populates an array of variables which are then passed to Smarty for use in fred.html

When a request is made for page "fred", the main script looks for these templates and files, and calls the function fred().

Is that the kind of thing you are looking for?
Link to comment
Share on other sites

Smarty is a template engine, not a plugin engine. :)

Plugins, aka modules, are interface designed objects that 'slot' into place and work alongside the main application.

Your plugins will need to know when to act and when to stop, likewise your main application will need to know when, and how to tell your plugins to start, and when to stop.

This is a very ambiguous aspect, so I'm sparing details as it comes down to personal preference on how to implement, as much as it does technical limitations.

However, I do [b]strongly[/b] suggest you make good use of interface design.
Link to comment
Share on other sites

  • 4 weeks later...
i created a plugin system once that stored each individual plugin's code in a database, then i had plugin locations such as "page_start", "page_complete" and any other location i thought might have had the potential to need some code pluging into it.

i would then call a function that would load all the code from each specific location and add it to one long string, then i would eval it. worked well enough for my needs. :)
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.