Zikula: A Flexible Open Source Content Management System
home | forum | contact us

Dizkus

Bottom
Calling Functions Cross Modules
  • Posted: 01.01.2006, 12:46
     
    GamersRadio
    rank:
    Helper Helper
    registered:
     December 2003
    Status:
    offline
    last visit:
    10.10.06
    Posts:
    172
    I just started digging through the great module document from the forums and I have a silly question.

    Is it possible to call the function of a module from a different module? I have a module that I would like to be able to take the info and post it as news. Rather than pulling the function, can I just call the function directly if permissions permit?

    Thanks!
  • Posted: 01.01.2006, 19:23
     
    ainigma32
    rank:
    Professional Professional
    registered:
     January 2004
    Status:
    offline
    last visit:
    22.03.06
    Posts:
    958
    Sure, just do a pnModAPIFunc() call.
  • Posted: 01.01.2006, 19:46
     
    Simon
    rank:
    Steering Committee Steering Committee
    registered:
     December 2002
    Status:
    online
    Posts:
    13415
    You may need to do a pnModLoad() call first. Check the API guide.

    --
    Regards,
    Simon

    itbegins.co.uk - Zikula Consulting

    Please read the Support Guide
  • Posted: 02.01.2006, 01:36
     
    GamersRadio
    rank:
    Helper Helper
    registered:
     December 2003
    Status:
    offline
    last visit:
    10.10.06
    Posts:
    172
    Hammerhead, Which guide would that be? I've found two on postnuke.com and neither seem to have much outside a list of the API's themselves. Is there a better location to read about the pnAPI?

    Thanks,

    --
    Atomm Nihilo
    /www.gamenuke.org" title="PostNuke Resources For Gamers">/www.rtfg.net" title="Read The F#$%ing Google!">
  • Posted: 03.01.2006, 06:55
     
    fabien.benetou
    rank:
    Freshman Freshman
    registered:
     October 2005
    Status:
    offline
    last visit:
    03.01.06
    Posts:
    7
    Maybe he was thinking about module hooks ?
  • Posted: 05.01.2006, 08:22
     
    jbirchett
    rank:
    Helper Helper
    registered:
     November 2002
    Status:
    offline
    last visit:
    29.05.07
    Posts:
    203
    Actually, I noticed this when I was documenting the Example module. The API docs say you must call pnModLoad() before calling pnModAPIFunc(), but the Example module doesn't. I was going to dig into this a little further, but I haven't had time yet. Another example is in the RSS module, which calls functions from the Categories module, but doesn't call pnModLoad().
  • Posted: 05.01.2006, 13:16
     
    Simon
    rank:
    Steering Committee Steering Committee
    registered:
     December 2002
    Status:
    online
    Posts:
    13415

    Quote

    Actually, I noticed this when I was documenting the Example module. The API docs say you must call pnModLoad() before calling pnModAPIFunc(), but the Example module doesn't.


    All the docs have yet to be updated to reflect this, you no longer have to explicitly load the API for your module before calling API functions, as the core handles this automatically. Additionally, all system modules (which probably includes Categories) are loaded by the core already and so don't need explicit loading. The only modules you must now load before calling are non-system modules.

    --
    Regards,
    Simon

    itbegins.co.uk - Zikula Consulting

    Please read the Support Guide
  • Posted: 06.01.2006, 00:37
     
    GamersRadio
    rank:
    Helper Helper
    registered:
     December 2003
    Status:
    offline
    last visit:
    10.10.06
    Posts:
    172
  • Posted: 13.01.2006, 09:34
     
    GamersRadio
    rank:
    Helper Helper
    registered:
     December 2003
    Status:
    offline
    last visit:
    10.10.06
    Posts:
    172
    I've started working on this, but it is not working how I understood it. Would someone tell me if this looks right?

    Code

    $output .= pnModAPIFunc('AddStory',
                               'admin',
                               'adminStory');


    The error I receive is Error! Called unknown function: AddStory_adminapi_adminStory()

    Thanks!

    --
    Atomm Nihilo
    /www.gamenuke.org" title="PostNuke Resources For Gamers">/www.rtfg.net" title="Read The F#$%ing Google!">
  • Posted: 13.01.2006, 09:34
     
    GamersRadio
    rank:
    Helper Helper
    registered:
     December 2003
    Status:
    offline
    last visit:
    10.10.06
    Posts:
    172
    I've started working on this, but it is not working how I understood it. Would someone tell me if this looks right?

    Code

    $output .= pnModAPIFunc('AddStory',
                               'admin',
                               'adminStory');


    The error I receive is Error! Called unknown function: AddStory_adminapi_adminStory()

    Thanks!

    --
    Atomm Nihilo
    /www.gamenuke.org" title="PostNuke Resources For Gamers">/www.rtfg.net" title="Read The F#$%ing Google!">
  • Posted: 13.01.2006, 09:58
     
    Topiatic
    rank:
    Professional Professional
    registered:
     November 2003
    Status:
    offline
    last visit:
    23.11.08
    Posts:
    1676
    Probably because AddStory isn't API compliant yet.

    --
    Under Construction!
  • Posted: 13.01.2006, 21:06
     
    GamersRadio
    rank:
    Helper Helper
    registered:
     December 2003
    Status:
    offline
    last visit:
    10.10.06
    Posts:
    172
  • Posted: 13.01.2006, 21:55
     
    rank:
    Moderator Moderator
    registered:
     March 2002
    Status:
    offline
    last visit:
    26.08.08
    Posts:
    7720
    Gamersradio,

    Just FYI - modules that are API compliant are identified by a type 2 entry in the type field of the modules type and have functions in pnuser(API).php and pnadmin(API).php.

    PostNuke 0.8x will be fully pnAPI compliant - absolutely no legacy module code at all....

    -Mark
  • Posted: 15.01.2006, 02:17
     
    Paustian
    rank:
    Helper Helper
    registered:
     May 2005
    Status:
    offline
    last visit:
    20.11.08
    Posts:
    129
    What is the time line for PostNuke 0.8? I am especially interested in the improved speed of loading. :D

    Don't get me wrong, I am not complaining. I am very happy with the pace of development and the thinking behind the gradual roll-out. Just wondering.
  • Posted: 15.01.2006, 02:23
     
    Simon
    rank:
    Steering Committee Steering Committee
    registered:
     December 2002
    Status:
    online
    Posts:
    13415

    Quote

    What is the time line for PostNuke 0.8? I am especially interested in the improved speed of loading.


    There's never a long term timeframe for releases I'm afraid, however we'd like to see a .8 Mile Stone release to give developers a chance to test their third party code sometime in this quarter, preferably earlier rather than later.

    --
    Regards,
    Simon

    itbegins.co.uk - Zikula Consulting

    Please read the Support Guide

Extensions Moderation

Main Menu

Extensions Database

Documentation

Development

Login

Donate to Zikula