Fork me on GitHub

Won't load from Db  Bottom

  • okay, i'm in the beginning of this module. It writes to the DB with the correct info, but wont show. "Sorry. Item load failed" I've checked the script over and over but cant find whats wrong... So maybe a second opinion could work?

    Pntables;
    $pntable['writer_characters_column'] = array('characterid' => $Characters . '.characterid',
    'categoryid' => $Characters . '.categoryid',
    'charname' => $Characters . '.charname');


    From pnadmin.php
    function Example_admin_new()
    {
    if (!pnSecAuthAction(0, 'Example::', '::', ACCESS_ADD)) {
    return pnVarPrepHTMLDisplay(_MODULENOAUTH);
    }

    $pnRender =& new pnRender('Example');

    $pnRender->caching = false;

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


    function Example_admin_create($args)
    {

    list($categoryid,
    $charname) = pnVarCleanFromInput('categoryid',
    'charname');
    extract($args);

    if (!pnSecConfirmAuthKey()) {
    pnSessionSetVar('errormsg', pnVarPrepHTMLDisplay(_BADAUTHKEY));
    pnRedirect(pnModURL('Example', 'admin', 'view'));
    return true;
    }

    if (!pnModAPILoad('Example', 'admin')) {
    pnSessionSetVar('errormsg', pnVarPrepHTMLDisplay(_LOADFAILED));
    pnRedirect(pnModURL('Example', 'admin', 'view'));
    return true;
    }

    $characterid = pnModAPIFunc('Example',
    'admin',
    'create',
    array('categoryid' => $categoryid,
    'charname' => $charname));

    if ($characterid) {
    // Success
    pnSessionSetVar('statusmsg', pnVarPrepHTMLDisplay(_EXAMPLECREATED));
    }


    pnRedirect(pnModURL('Example', 'admin', 'view'));

    // Return
    return true;
    }
    _______________________________________
    function Example_admin_view()
    {
    $startnum = pnVarCleanFromInput('startnum');

    if (!pnSecAuthAction(0, 'Example::', '::', ACCESS_EDIT)) {
    return pnVarPrepHTMLDisplay(_MODULENOAUTH);
    }

    if (!pnModAPILoad('Example', 'user')) {
    return pnVarPrepHTMLDisplay(_LOADFAILED);
    }

    $pnRender =& new pnRender('Example');

    $pnRender->caching = false;

    $itemsperpage = pnModGetVar('Example', 'itemsperpage');

    $items = pnModAPIFunc('Example',
    'user',
    'getall',
    array('startnum' => $startnum,
    'numitems' => $itemsperpage));

    foreach ($items as $key => $item) {

    if (pnSecAuthAction(0, 'Example::', "$item[categoryid]::$item[characterid]", ACCESS_READ)) {

    $options = array();
    if (pnSecAuthAction(0, 'Example::', "$item[categoryid]::$item[characterid]", ACCESS_EDIT)) {
    $options[] = array('URL' => pnModURL('Example', 'admin', 'modify', array('characterid' => $item['characterid'])),
    'title' => _EDIT);
    if (pnSecAuthAction(0, 'Example::', "$item[categoryid]::$item[characterid]", ACCESS_DELETE)) {
    $options[] = array('URL' => pnModURL('Example', 'admin', 'delete', array('characterid' => $item['characterid'])),
    'title' => _DELETE);
    }
    }

    $items[$key]['options'] = $options;
    }
    }

    $pnRender->assign('exampleitems', $items);

    $pnRender->assign('pager', array('numitems' => pnModAPIFunc('Example',
    'user',
    'countitems'),
    'itemsperpage' => $itemsperpage));

    // Return the output that has been generated by this function
    return $pnRender->fetch('example_admin_view.htm');
    }

    ________________________________________
    function Example_admin_new()
    {
    if (!pnSecAuthAction(0, 'Example::', '::', ACCESS_ADD)) {
    return pnVarPrepHTMLDisplay(_MODULENOAUTH);
    }

    $pnRender =& new pnRender('Example');

    // We need the pnsecgenauthkey plugin, so we must not cache here.
    $pnRender->caching = false;

    // Return the output that has been generated by this function
    return $pnRender->fetch('example_admin_new.htm');
    }

    From template; admin view
































    From template; Admin new


















    <label for="categoryid"></label>
    <label for="charname"></label>





    HEEEEEEEEEELP :)
  • Did you try putting a test item in via the DB? I don't really know how pnRender mods work...so this comment is more of a bump...
  • Yepp.. the DB is populated.. but no show on the site..
  • echo out the SQL - if you paste it into phpMyAdmin, does it work?

    --
    itbegins.co.uk - Zikula Consulting

    birtwistle.me.uk - Personal Blog


    Please read the Support Guide
  • oooopsies... I had just completely forgotten the userapi... *blushing* ...

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