Fork me on GitHub

Howto realize Expendable modules?  Bottom

  • Hi!

    I'm currently planing/writing a .8 module, that should be expendable by other module developers, to make the content of their modules available to my module.
    What I have problems with, is to choose a good way on how my module can communicate with other modules. Currently I have two ideas. The first one would be to use a own API for it. So the News module for example would create a file called pnextendapi.php and define an info() function like this: function News_extendapi_info(). My module could then call that function via pnModAPIFunc ('News','extendapi','info',array()).

    The other possibility I thought of would be , to make the other modules implement a Class with certain functions, that my module could then load via loadClassFromModule(). The problem with this, is that I do not yet understand that objectLib stuff completely. Is it right, that module class has to be extended from PNObject? And if so, would it be enough if my module implements a template class, from which the third party modules need to be extended?

    For example:

    class myModulesClass extends PNObject

    and a third-party module would use

    class thirPartyClass extends myModulesClass

    I'm not sure although, if that isn't a "misuse" of the PNObjectLib icon_confused

    Anyway: Those are the two solutions I cam up with. What do you guys think? Which of the two would be the best/fastest (in terms of runtime)? Maybe I missed another possibility?

    Thanks for any answers! icon_smile

    -Martin

    --
    Linux is like a Wigwam, no Gates, no Windows and an Apache inside!
  • In terms of performance I'd choose the first solution, but relating maintainability and extensibility I'd prefer the second approach.

    PNObject encapsulates functionality being specific for this type of object. This functionality is called business logic or behavior. Therefore you need only one use case in your pnfoo.php - so instead of mymod_user_editcustomer() and mymod_user_editorder() you need only mymod_user_edit($ot) whereby $ot is the object type. This component model represents the future coding style by following object-oriented principles and separating system use cases from business use cases.

    Defining a moduleClass extending PNObject allows you to define new methods to introduce new use cases (like startMyFunction). Subclassing by third parties will be the right way to implement the specific realisations then. This approach is no misuse, but recommended icon_smile

    --
    Guite | ModuleStudio
  • That can be another application of my pnPlugin proposal (if your module requirement are too specifics and not sufficient general to implement the pnextendapi on each module).

    Each plugin may implement the requirement to get communication with other module, or get some information. The plugin functions to use can be defined by your module in a structure of how to be implemented for other module developers.

    I'm not sure what's your module functionality, so i can't get a better approach.
    And with Robert Gasch will study if the pnPlugin proposal is viable to implement with PNObject icon_smile .

    --
    - Mateo T. -
    Mis principios... son mis fines
  • Sorry for my late reply. Was stuck with installing Gentoo Linux on my Notebook the last few days.

    First. Thank you for replying and for giving me some hints.

    I'd like to give you a small look into what my module should be.

    I suppose you all know iGoogle? My module will be basically the same, just for PostNuke, and not working with JavaScripted content (as in iGoogle), but with content provided by other modules (e.g. the News module could supply some TOP Headlines on a given topic, a Weather module could supply Weather info, a Quiz module could provide the first question to a quiz and upon successfully answering it, redirect you to the full quiz, ASO). Sounds much like Blocks, right?
    Well it's better. What I want to do, is to implement a system, where the page owner (and maybe later the user) can define his/her own templates for the content boxes (I call them SnapIns). So a admin could create a template with one line consisting of room for 4 SnapIns, then a line with static content like Google adds, and then a line with just two, but bigger SnapIn positions. He could then put the SnapIn he wants into their positions, "lock" the whole Layout (or just leave it open for the user to rearrange SnapIns) and has his own PostNuke page, with his own layout. A second possibility would be, to let the users create their layouts, and that way building their own custom front page, with the information they want.
    If my module works out as planed, it can be used to create highly customizable front pages in PostNuke, so that not every page looks like the other.
    I hope all I wrote makes sense to you. I'm rather tired (and completing the Linux setup is nowhere finish icon_wink ).

    -Martin

    --
    Linux is like a Wigwam, no Gates, no Windows and an Apache inside!
  • I've readed that Jorn is thinking about something like that in one of his modules. You have to try it and share ideas with Jorn, it may be useful.

    Your module requirement are different (very specific). You can some ideas and implementation ways of the 'blocks/snapins' and include it to your module.



    edited by: nestormateo, Oct 02, 2007 - 03:54 PM

    --
    - Mateo T. -
    Mis principios... son mis fines
  • Hi Urd. You might want to look at this thread: http://community.postnuke.com/module-Forum-viewtopic-topic-53152.htm where I, as Mateo says, discuss the same issue. The idea is basically the same - compose pages with content plugins/snapins from other modules, but with a lot more "bells and wistles".

    I have started work on this project already and has created a NOC project for it: http://noc.postnuke.com/projects/content/. The code for adding and moving pages is there, and some of the content addition stuff is also there. But none of it is really demoable yet.

    And the module is "Content", not CoType as Mateo says - that's another module that focuses on creating books.
  • From what I saw, by quickly reviewing the posts, it looks very interesting.
    I need to read the posts again as soon as I'm done with my Notebook... icon_rolleyes

    --
    Linux is like a Wigwam, no Gates, no Windows and an Apache inside!

This list is based on users active over the last 60 minutes.