Fork me on GitHub

basic questions  Bottom

  • Hello all,

    I'm new to PHP and postnuke so sorry if my questions are too simple.

    - I'd like to add my own business objects to be used for example from pnadminapi.php ou pnuserapi.php.
    Where is the best place in a module architecture to add theses classes?

    For example I'd to have something like that :

    Code

    MyModule
        |
        myBusinessObjectPackage
            |
             - mypackage1
            |   myclass1.php (with class MyClass1 inside...)
            |   myclass2.php
            |   ...
             - mypackage2
                myclass3.php
                myclass4.php
                ...

    pninit.php
    pnadminapi.php
    ...




    - How could one of my business classes be called for example from pnadminapi.php or pnuserapi.php?
    for example :

    Code

    $m = new MyClass1();
    $m->DoSomething();


    I get an empty white screen when I use include_once('myBusinessObjectPackage/mypackage1/myclass1.php') statements or something like that.


    Thanks.

    Cr
  • I have found that most of my Postnuke scripts default to the main PN directory, so try putting "modules/myModule/myBusinessObjectPackage" etc.
  • As jediping has said always use a path from the root of the PN site. To explain things think about how your module code is actually accessed (i.e. via index.php?module=mymod......). The entry point for PN is index.php in the root of the site therefore all includes/requires should be relative to the PN root.

    -Mark

    --
    Visit My homepage and Zikula themes.
  • Thanks a lot to both of you.

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