Fork me on GitHub

2 instances of one module?  Bottom

  • This particular module is zClassifieds, but I've seen this admin_excute with other modules, so I guess its a PN thing, and not the individual module? I've posted on the home forum, but there is very little activity there.

    Is there something else other than table names I should be changing when I attempt to install 2 instances of this module? When I try to install the second instance I get an error in the admin area

    Code

    admin_execute(modules/xxxxxx/admin.php,xxxx_admin_main)

    Any ideas?
    The main module area looks fine, and even if I use the same database as my first instance, everything is grabbed fine. (but this error is still in the admin area)

    This coding is at the top of admin.php and I think its the "pnSecAuthAction" that is the culprit, but I don't know why.. Below this is the menu function, which is not loading so the problem is before that function, right?

    Code

    if (!eregi("admin.php", $PHP_SELF)) {
        die ("Access Denied");
    }

    $ModName = basename( dirname( __file__ ) );

    if (pnSecAuthAction(0, 'Annonces::', '::', ACCESS_ADMIN)) {

    modules_get_language();


    Thanks,
    - Carole
  • I am running 5 instances of PostCalendar 4.0....

    To do this you will need a decent text editor with global find/replace. I had to change over 1800 instances of code including database tables, functions, and a few file names. It was worth it in the long run. Once you have one hacked duplicate that works it takes minutes to reproduce a second and third one :)

    First you need to choose a 2 "letter" combination of that exists no where else in the module files. Do not use numbers! To do this do a global find (including subdirectories) for "GX" for example. If GX turns up not found in any of the files than you will use this to append all database tables, functions, etc that will otherwise have conflicts with the the original unhacked module.

    First do a global find'replace and append the database tables and inserts in pninit.php... this will also append many function calls in other files dependent on the database.

    After this upload the hacked version and run it along side the original to find additional function or "class cannot be redeclared" errors. This will show you which functions you need to append with your 2 letter combination that are independent of the database.

    For a text editor with a nice glabal find/replace try the standard version of http://notetab.com

    Let me know if you succeed wink
  • Thanks for taking the time to write that. I'll try it tomorrow and see if I fare any better, lol
    - Carole
  • This seems to be EXACTLY what I am looking for help with. Specifically, I need multiple instances of the Ephemerids module. However, there is no pninit.php file included with this module. Do you have any advice for this module?

    Joe Dunn
  • i want to have 2 instances of the reviews module and have tried to follow your giude thing and have replaced all reviews with reviewsgx and it still doesnt work?
  • Instead of doing hard coded replaces, would it be possible to replace these tags,variables, etc. with template variables and then create as many instances as you need with say, Smarty or the like?
  • Quote


    Instead of doing hard coded replaces, would it be possible to replace these tags,variables, etc. with template variables and then create as many instances as you need with say, Smarty or the like?

    mediatech is talking about changing the actual names of a function in a true PostNuke module. Function names must be hardcoded in PHP. When you call them you can use a variable, but the definition of the function itself must be hardcoded.

    Modules that aren't true PostNuke modules are actually easier to change because you should only need to change the name of the Module directory, the database tables, and any hardcoded references to the path of the module where the original module name may have been used. If the coder was smart they used a function to figure out the name of the module directory rather than hardcoding it which makes the conversion easier. Easier when you want to change the name of your module too :)

    To All -
    Duplicating a true PostNuke API compliant module will give you a lot of headaches if you don't fully understand how the system works. If you are a newbie you may want to ask yourself if you really need a duplicate module and then consider getting someone to do it for you. Of course what better way to figure out how the system works right :D
  • All of this implies a good tip for module developers:
    If there is any chance multiple instances of a module will be required, add an additional top level instance key to every table. That way each block instance can point to a different set of data.

    Then the same application can used in all module/block instances.

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