Fork me on GitHub

definitive module creation guide - and some other questions  Bottom

  • Hi,

    I have been using postnuke for quite some time now, and have contributed to many mods etc. to existing modules and now i am trying my hand at creating a module.

    i have just finished an upgraded version of pnamazon that use REST/ECS 4.0 and would now like to "modularize it".

    Essentially, I would like to create 4 arrays in the initialization process:

    1. for locale
    2. for modes (categories)
    3. for searchtype
    4. xmlserver to use

    plus i have a couple variables for:

    1. associateid
    2. subid
    3. default mode
    4. default browsenode
    5. showxml request

    etc.

    now i have been playing with the Example module as suggested and i am running into a couple roadblocks on the way.

    first off:

    1. how do i create the multiple tables?
    2. whenever i assign a variable via PNmodSetVar for a string that includes alphanumeric characthers or dasshes (-) the initialization fails. it appears enclosing these variables with ' ' allows initialization. however if i then go to the admin page and attempt to change a setting, i get Sorry! Item failed to load and then some of the variables lose their settings.

    i have trolled near and far in search of a step by step definitive guide to:

    1. Modules creation howto
    2. Using pnRender

    one additional question: Can i use PNrender for caching eventhough i do not have a API-compliant module?

    thanks

    supa

    --
    ttgapers.com - the latest from the caribbean
    Caribbean News
    Online Shopping from USA, Canada, UK, France, Germany
    On Facebook
  • first, make sure you are using the most recent version of the Example module. the most recent version of PN (available here) would contain it.

    Then you have to sort of read the the whole module as a guide. Of course it helps a lot if you have a strong background in PHP. The MDG (available from link on left) is old, yes, but the concepts are (in general) still true and useful.

    1. create multiple tables: duplicate the code in the pninit.php hfile where the table is created so you can do it twice. You'll need to define two sets of field definitions and then use the CreateTableSQL() twice to create two tables.

    2. using pnRender is actually pretty easy once you get the hang of it. I suggest writing the HTML how you want it, then figuring out where the data goes. YOu have to assign the data to the template. This is all explained pretty well in the example mod. I also recommend you check out the Smarty documentation as all the functions are available (you just have to use a different set of characters to kick them off).

    I do not believe you can take advantage of caching with pnRender-compliance.

    to store variables with odd characters (and really for ANY data) you should take advantage of the pnVarPrepForStore() function.
  • 0 users

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