Fork me on GitHub

How debug zikula  Bottom

  • How debug zikula:
    - echo, print_r, var_dump - don't work
    - netbeans and xdebug - breakpoints don't work
    How?

    Thanks for reply
  • pndebug ?
    - assigned template variables
    - Zikula session variables
    - assigned config file variables

    Example:
    index.php?module=Groups&func=view

    Code

    <!--[$SCRIPT_NAME]-->        "/echupl/index.php"
    <!--[$active]-->    "1"
    <!--[$baseuri]-->   "/echupl"
    <!--[$baseurl]-->   "http://localhost/echupl/"
    <!--[$bid]-->   "1"
    <!--[$bkey]-->  "extmenu"
    <!--[$blanguage]-->     ""
    <!--[$collapsable]-->   "1"
    <!--[$content]-->   "<div id="navcontainer_1" class="nav..."
    <!--[$defaultstate]-->  "
    1"
    <!--[$filter]-->    Array (0)
    <!--[$func]-->  "
    view"
    <!--[$imagelangpath]-->     "
    http://localhost/echupl/themes/andreas08/images/eng"
    <!--[$imagepath]-->     "http://localhost/echupl/themes/andreas08/images"
    <!--[$lang]-->  "eng"
    <!--[$language]-->  ""
    <!--[$last_update]-->   "2009-05-27 18:21:11"
    <!--[$loggedin]-->  true
    <!--[$maincontent]-->   "<div id="pn-maincontent" class="pn-module-Groups"><div >..."
    <!--[$mid]-->   "11"
    <!--[$minbox]-->    ""
    <!--[$module]-->    "Groups"
    <!--[$pagetype]-->  "module"
    <!--[$palette]-->   "palette1"
    <!--[$position]-->  "left"
    <!--[$profileMod]-->    ""
    <!--[$refresh]-->   "3600"
    <!--[$scriptpath]-->    "http://localhost/echupl/themes/andreas08/javascript"
    <!--[$stylepath]-->     "http://localhost/echupl/themes/andreas08/style"
    <!--[$themepath]-->     "themes/andreas08"
    <!--[$title]-->     "Main menu"
    <!--[$type]-->  "user"
    <!--[$uid]-->   "2"
    <!--[$url]-->   ""


    pnuser.php

    Code

    function Groups_user_view()
    {
        // Security check
        if (!SecurityUtil::checkPermission('Groups::', '::', ACCESS_OVERVIEW)) {
            return LogUtil::registerPermissionError();
        }

        // Get parameters from whatever input we need.
        $startnum = (int)FormUtil::getPassedValue('startnum', null, 'GET');
        $show = FormUtil::getPassedValue('show', null, 'GET');
        $showgid = FormUtil::getPassedValue('showgid', null, 'GET');
        // we need this value multiple times, so we keep it
        $itemsperpage = pnModGetVar('Groups', 'itemsperpage');

        if (pnUserLoggedIn()) {
            $islogged = true;
        } else {
            $islogged = false;
        }

        // The user API function is called.
        $groups = pnModAPIFunc('Groups', 'user', 'getallgroups',
                               array('startnum' => $startnum,
                                     'numitems' => $itemsperpage,
                                     'uid'      => pnUserGetVar('uid'),
                                     'islogged' => $islogged));

        $pnRender = pnRender::getInstance('Groups', false);
        $pnRender->add_core_data();
        $pnRender->assign('mainpage', true);

        // The return value of the function is checked here, and if the function
        // failed then an appropriate message is posted.
        if ($groups == false) {
            $pnRender->assign('nogroups', true);
            return $pnRender->fetch('groups_user_view.htm');
        }

        // load the admin language file
        pnModLangLoad('Groups', 'admin');

        $groupitems = array();
        $typelabel  = array();
        $statelabel = array();

        $typelabel = array('-1' => _GROUPS_CORE,
                           '0'  => _GROUPS_CORE,
                           '1'  => _GROUPS_PUBLICSHORT,
                           '2'  => _GROUPS_PRIVATESHORT);

        $statelabel = array('0' => _GROUPS_CLOSED,
                            '1' => _GROUPS_OPEN);

        foreach ($groups as $group) {

            if (SecurityUtil::checkPermission('Groups::', "$group[name]::$group[gid]", ACCESS_OVERVIEW)) {

                $group['typelbl']  = $typelabel[$group['gtype']];
                $group['statelbl'] = $statelabel[$group['state']];

                $pnRender->assign($group);

                if ($islogged == true && SecurityUtil::checkPermission('Groups::', "$group[name]::$group[gid]", ACCESS_READ)) {
                    // The right to apply
                    $groupitems[] = $pnRender->fetch('groups_user_grouprow_read.htm', $group['gid']);
                } else {
                    // No right to apply
                    $groupitems[] = $pnRender->fetch('groups_user_grouprow_overview.htm', $group['gid']);
                }
            }
        }

        $pnRender->add_core_data();
        $pnRender->assign('nogroups', false);
        $pnRender->assign('items', $groupitems);
    $pnRender->assign('groups', $groups);
        $pnRender->assign('pager', array('numitems'     => pnModAPIFunc('Groups', 'user', 'countitems'),
                                         'itemsperpage' => $itemsperpage));

        return $pnRender->fetch('groups_user_view.htm');
    }


    I want to see: $groups. How?

    I know: pndebug --> groups_user_view.htm

    Thank you mumuri!



    edited by: dariuszg, May 28, 2009 - 08:56 PM
  • If you want to see a variable that is not assigned to any template you can always use die(print_r($var));
    It's a really easy form of debug but it works icon_razz

    --
    Zikula Italia
    SimpleGallery
  • sometimes i just print_r inside the controller (pnuser.php) and it's printed in the very beggining of the page...

    --
    - Mateo T. -
    Mis principios... son mis fines
  • 0 users

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