SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Evangelist
    Join Date
    Oct 2001
    Location
    Texas
    Posts
    598
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Creating Pluggins for you software

    I was just wondering how people go about designing there software so that 'plugins' (loosely used here) can be added or removed. For example I am creating a php software program that I would like users to be able to add certain features onto it if they wanted but I only want to update the base code when I need to make updates for bugs, security etc.

    Just looking for ideas.

  2. #2
    Programming Team silver trophybronze trophy
    Mittineague's Avatar
    Join Date
    Jul 2005
    Location
    West Springfield, Massachusetts
    Posts
    16,460
    Mentioned
    160 Post(s)
    Tagged
    1 Thread(s)

    plugins

    phpBB has MODs to add features. These are modifications of the core files. Not what you're looking for here. WordPress has plugins. These are "registered" (added to the "available plugin" database) and then "included" when the app loads. AFAIK browser add-ons use similar logic except the "extras" are listed in a file.

  3. #3
    SitePoint Enthusiast
    Join Date
    Jan 2006
    Posts
    51
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The Drupal CMS has a directory called "modules" which is scanned when you load the related admin page. Then with a check box the user can enable the module (this status is stored in the database). On every subsequent page load the enabled modules are included.

    A generic invoke function looks through all of the loaded modules for functions which follow the API naming convention. So, for example, when it's time to load blocks it checks every module for a function called modulename_blocks.

  4. #4
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Umm...

    There must be a hundred and one different ways of doing this; The only thing I can do is to explain how I do it?

    I build the page up of Composite parts, each Composite being an Action, so prior to exection of this Composite structure, I recurse over it. Think of the Action being the Controller [MVC], so the module/plugin in it's self is also of the same type.

    As I recurse over the structure, I inject a module/plugin as required, for that given Composite in question, in which case there may be one or more, or none for that matter, modules/plugins. Since the module/plugin is based on MVC, they are executed normally as expected, generating the content required, etc.

    Not sure how well you know design patterns (Composite/Visitor/Specification) or how well your object oriented programming skills are but this is how I do it, so hope it helps anyways

  5. #5
    SitePoint Evangelist jplush76's Avatar
    Join Date
    Nov 2003
    Location
    Los Angeles, CA
    Posts
    460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hey Doc, you've given me a nice idea for something I was working on. Do you have an example of building your page out of composite pieces?
    My-Bic - Easiest AJAX/PHP Framework Around
    Now Debug PHP scripts with Firebug!

  6. #6
    SitePoint Wizard silver trophy kyberfabrikken's Avatar
    Join Date
    Jun 2004
    Location
    Copenhagen, Denmark
    Posts
    6,157
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Wbmstr84 View Post
    I would like users to be able to add certain features onto it if they wanted but I only want to update the base code when I need to make updates for bugs, security etc.
    Write your applications with low coupling and high coherence.

  7. #7
    SitePoint Evangelist
    Join Date
    Jun 2003
    Location
    Melbourne, Australia
    Posts
    440
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    jplush76, do a search in this forum on "composite". The good Dr has provided many examples in the recent past.
    Zealotry is contingent upon 100 posts and addiction 200?

  8. #8
    Non-Member
    Join Date
    Jan 2003
    Posts
    5,748
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    > Do you have an example of building your page out of composite pieces?

    Other that what I've posted to these forums, I'm not prepared to post any thing new for the time being, sorry...

    Was there anything in particular you had in mind though?

  9. #9
    SitePoint Evangelist
    Join Date
    Oct 2001
    Location
    Texas
    Posts
    598
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the input everyone... kinda got my ideas going... but will take much more research.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •