1
redheadedrod
How to program "plugins"

I am curious what the best way of adding plugins into modules.

There are basically two different flavors of plugins, those you know about when you write the main program, and those you allow support when you write the main module but you don't know about at the time you wrote the main module...

With the first way you can check for the plugin or add on module and use it if it is there.. And this is hard coded into the programs.

I am considering as an example that if we had the main PROFILE module as it is now and we just add support for plugins that we don't know about at the time of the modification. Then we are free to have say content plugins, display plugins, search plugins etc...

What would the easiest way of adding support into a program to look for plugins unknown to the original module?

Thanks!

Rodney

2
Burning
Re: How to program "plugins"
  • 2010/10/14 22:25

  • Burning

  • Theme Designer

  • Posts: 1163

  • Since: 2006/8/22


hi'

I do not understand what you are looking for exactly (not your fault, but mine, I do not speak dev' language and it is worst in english).

But if you are looking for a plugins' specialist, you should take a look to Dugris' website (www.dugris.info)

... my two cts
Still learning CSS and... english

3
redheadedrod
Re: How to program "plugins"

Hey Burning, in short...

I am looking for a method to add the ability to add plugins to a module to add functionality to the module. The module should not have to know to look for specific modules.

As an example...

CBB can make use of the xoopspoll module. It will recognize its existence and make use if it if it is there. In order to add support for a calendar or other module CBB would have to be changed to make use of it.


This of course would be a module reusing the functions of another module. This is a great concept because as you add to the second module (xoopspoll in this case) you are adding more flexibility to the original module. (CBB in this case)

There are other examples that use plugins specific to the module but I can't think of exact examples at this time. But again in those cases the original module knows about the existence of specific plugins and it is hardcoded. If you want to add more plugin's later you have to code support into the main module as well.

What I am looking to do is have a module that you can add stuff to later by coming out with a plugin instead of rewriting the whole module.

As an example...

To further the PROFILE example.
As some know people have modified the original profile module to add most of the "yogurt" stuff to it.
What about if we have a PROFILE module that instead allows for plugins that are NOT hardcoded into the module. Then we can add support for different things into profile without actually haveing to recode profile to add every little thing. So we have a small plugin to add media such as video or sound. Another to use whatever photo gallery we have installed. Another to give users the ability to customize their profile's look.

What I am looking for is HOW do you add the functionality for this type of plugin to a module. Yes it is a programming question.

Rodney

4
iHackCode
Re: How to program "plugins"

the believe the HOW is:

in administration:
a page that lists the plugins in a directory
the ability to enable and disable a plugins
* the enabling puts that plugins in the list of active plugins (maybe do more with it and you can get configurable options for the plugin)

in user mode:
the 'profile' page loads the fields and the plugins that are enabled for that user type (does a database query on the loaded plugins for that user level (or something), but could be faster to cache this data in a file for faster retrieval)

.. so the administration level checks whats available and you enable what you want. and in the user level the page/item/profile loads what is enabled (based on a criteria like user level if you like). this is how the modules are done, also similar to the plugins for the editors for the forum, CBB xfer options (but those are coded in the plugin files themselves)
CBB / LatestNews / Publisher / XM-Spotlight

(ノ◕ヮ◕)ノ*:・゚✧

5
blackrx
Re: How to program "plugins"
  • 2010/10/18 1:01

  • blackrx

  • Quite a regular

  • Posts: 227

  • Since: 2008/2/5 1


see also rmcommon

6
redheadedrod
Re: How to program "plugins"

rmcommon has what I am calling blind plugins?

Will have to check that out...

Thanks...

Rodney

7
nmshah
Re: How to program "plugins"
  • 2010/10/18 4:44

  • nmshah

  • Just can't stay away

  • Posts: 556

  • Since: 2007/7/2 8


An example of what you are looking for is I think the "Sitemap Module" by Gijoe which displays the content of other modules in the sitemap if a plugin for those modules are available in the plugins directory of "Sitemap Module".

8
redheadedrod
Re: How to program "plugins"

Ok thanks... I will have to look at that..

Might be a better option for me to look at actually.

Rodney

9
Burning
Re: How to program "plugins"
  • 2010/10/18 11:50

  • Burning

  • Theme Designer

  • Posts: 1163

  • Since: 2006/8/22


hi'

As far I know, there are many ways / definitions for Xoops plugins :


1. Plugins coded to improve Xoops Core

It is a simple .php file that we add into www/class/smarty/xoops_plugins/

Eg:
• Trabis :https://xoops.org/modules/news/article.php?storyid=4733
• Dugris :http://www.dugris.info/documentations/article.php?storyid=37


2. Plugins coded to allow modules to interact with each other

It is a simple .php file that we add into a specific folder, www/modules/your-module/plugins/

Eg:
• Sitemap : if the plugin is not available, then sitemap only show main categories (you may try xSitemap developed by Urbanspaceman, we can create plugins directly from the back office)
• RSSFit : if the plugin is not available, then module RSS is not displayed
• others...



But there are other ways to make modules interact with each other :
• GiJoe has developed D3Forum to manage forums and to centralize all comments left on your site (more exactly comments left on Pico, and some Happylinux modules like Weblinks and WebPhoto)
• Some developers add an option about another "transversal" module, Tellafriend. Into Content module, developed by MusS, you can choose to use it or not. I believe Tag module works also like that...
Still learning CSS and... english

10
redheadedrod
Re: How to program "plugins"

Ok, I guess I should mention what I am looking at and go from there.. Talking about these things has gotten me thinking about the profile module...

And looking at the socialnet 2010 module and such gets me thinking about the profile module a little bit more.


Basically what I am looking at is taking profile and stripping it down to basics.

It will allow plugins that will define new "types" of information you can add to your profile.

Then you add plugins that will handle these new data types. The intention of these plugins would be to handle all aspects of that datatype.

A definition for the sql to add to the module for whatever the data type is. Any functions to add, edit, validate or display that datatype.

Since these data types would be unknown to profile I need a method of looking at them and adding them in. Likely will end up using classes for this but need to figure out a way to dynamically setup variables and such...

Also looking to add theming to it as well but not sure how to add that either.

Thinking the easiest way and most efficient way to do this is to build "macro" sheets that will allow inclusion of all the plugins into a rebuildable code page.

Basically have a "install plugin" function that will scan the directory and build a new .php file that would be included in the main module that should then include all the plugins. Seems a little crude but should work... This would then allow me to do the plugins relatively easily.

Unless there is an example of doing something like this.

Thanks!

Login

Who's Online

215 user(s) are online (119 user(s) are browsing Support Forums)


Members: 0


Guests: 215


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Mar 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits