Zikula: A Flexible Open Source Content Management System
home | forum | contact us

Dizkus

Bottom
Need help Modifying Reviews to handle Interviews instead
  • Posted: 03.06.2004, 13:13
     
    value
    rank:
    Freshman Freshman
    registered:
     February 2004
    Status:
    offline
    last visit:
    22.11.04
    Posts:
    15
    ive finished moding the admin.php and the language files

    everything works great till i try to run it from the index.

    Fatal error: Call to a member function on a non-object in modules/Interviews/index.php on line 503
    which correpsonds to something around here i believe

    Code

    $column = &$pntable['interviews_column'];
        $popquery = buildSimpleQuery('interviews', array ('id', 'title', 'hits'), $querylang, "$column[hits] DESC", 10);
        $result_pop = $dbconn->Execute($popquery);
        $x = 0;
        while (!$result_pop->EOF)  {
            list($id, $title, $hits) = $result_pop->fields;
            $ida[$x] = $id;
            $titlea[$x] = $title;
            $hitsa[$x] = $hits;
            $x++;
            $result_pop->MoveNext();
        }


    also when i try to view interviews posted under a or b etc i get this

    Error accesing to the database
    Program: [webroot]/modules/Interviews/index.php - Line N.: 631
    Database: ******
    Error (1064) : You have an error in your SQL syntax near ' , , , FROM WHERE UPPER() LIKE 'A%' ' at line 1

    any thoughts?
  • Posted: 05.06.2004, 10:30
     
    value
    rank:
    Freshman Freshman
    registered:
     February 2004
    Status:
    offline
    last visit:
    22.11.04
    Posts:
    15
    Bueller?? :)

    I think it may be an API issuse, does that give anyone any ideas?
  • Posted: 05.06.2004, 10:38
     
    mhalbrook
    rank:
    Legend Legend
    registered:
     December 1969
    Status:
    online
    Posts:
    6534
    There was a recent news item in the mods site about an interview module,
  • Posted: 05.06.2004, 13:02
     
    value
    rank:
    Freshman Freshman
    registered:
     February 2004
    Status:
    offline
    last visit:
    22.11.04
    Posts:
    15
    yeah i saw that but damnit if pnRender isnt a pain to get working. i installed in and init both it and xanthia but when i go to admin the interview module i get this error
    Fatal error: Cannot instantiate non-existent class: pnrender in modules/dpInterviews/pnadmin.php on line 15

    so rather than screw up my site even more i thought moding out a current module would be a bit safer.
  • Posted: 05.06.2004, 13:43
     
    value
    rank:
    Freshman Freshman
    registered:
     February 2004
    Status:
    offline
    last visit:
    22.11.04
    Posts:
    15
    i take that back, i cant init Xanthia it gives me a fatal error on the pninit.php file. tried downloading the one linked from the PostNuke modules page about the XTE release but it still wont work.
  • Posted: 29.09.2004, 06:43
     
    value2
    rank:
    Freshman Freshman
    registered:
     April 2004
    Status:
    offline
    last visit:
    05.10.04
    Posts:
    17
    well im finally getting a chance to work this out.

    the dpInterviews module was of no help. And any support for it is in Spanish that I could tell and made no sense to me. Installing 750 is not an option.

    So Im back to modifying the Reviews Module. Everything works fine until I try to look up Interviews of a certain letter or send an Interview to the DB.

    it says

    Error accesing to the database
    Program: [webroot]/modules/Interviews/index.php - Line N.: 690
    Database: mainsite
    Error (1064) : You have an error in your SQL syntax near ' nuke_interviews.pn_score FROM nuke_interviews WHERE nuke_inter' at line 1


    now that SQL select statement is the exact same except i changed this part of the function
    $reviewstable = $pntable['reviews'];
    $column = &$pntable['reviews_column'];

    to

    $interviewstable = $pntable['interviews'];
    $column = &$pntable['interviews_column'];

    and pntables.php has all the right entries and the DB was created with the same SQL just replaced nuke_reviews with nuke_interviews

    so it should work. but its not. any ideas at all?
  • Posted: 29.09.2004, 12:04
     
    value2
    rank:
    Freshman Freshman
    registered:
     April 2004
    Status:
    offline
    last visit:
    05.10.04
    Posts:
    17
    to make things even more complicated i reset this part
    $interviewstable = $pntable['interviews'];
    $column = &$pntable['interviews_column'];

    back to

    $reviewstable = $pntable['reviews'];
    $column = &$pntable['reviews_column'];


    and it worked fine but instead of loading the interviews it ofcourse loaded the reviews.

    why the hell does changing that listing effect the syntax so that it wont connect properly? im using $interviewstable in the SQL select statement and it doesnt work. and it wont send data to the DB either. when i try to add an interview it says it went through but it never shows up in the DB.
  • Posted: 30.09.2004, 23:58
     
    value2
    rank:
    Freshman Freshman
    registered:
     April 2004
    Status:
    offline
    last visit:
    05.10.04
    Posts:
    17
    this is what was added to pntables.php

    Code

    $interviews = $prefix . '_interviews';
    $pntable['interviews'] = $interviews;
    $pntable['interviews_column'] = array ('id'     => $interviews . '.pn_id',
                                        'date'      => $interviews . '.pn_date',
                                        'title'     => $interviews . '.pn_title',
                                        'text'      => $interviews . '.pn_text',
                                        'reviewer'  => $interviews . '.pn_reviewer',
                                        'email'     => $interviews . '.pn_email',
                                        'score'     => $interviews . '.pn_score',
                                        'cover'     => $interviews . '.pn_cover',
                                        'url'       => $interviews . '.pn_url',
                                        'url_title' => $interviews . '.pn_url_title',
                                        'hits'      => $interviews . '.pn_hits',
                                        'rlanguage' => $interviews . '.pn_language',
                                        'language'  => $interviews . '.pn_language');

    $interviews_add = $prefix . '_interviews_add';
    $pntable['interviews_add'] = $interviews_add;
    $pntable['interviews_add_column'] = array ('id'     => $interviews_add . '.pn_id',
                                            'date'      => $interviews_add . '.pn_date',
                                            'title'     => $interviews_add . '.pn_title',
                                            'text'      => $interviews_add . '.pn_text',
                                            'reviewer'  => $interviews_add . '.pn_reviewer',
                                            'email'     => $interviews_add . '.pn_email',
                                            'score'     => $interviews_add . '.pn_score',
                                            'url'       => $interviews_add . '.pn_url',
                                            'url_title' => $interviews_add . '.pn_url_title',
                                            'rlanguage' => $interviews_add . '.pn_language',
                                            'language'  => $interviews_add . '.pn_language');

    $interviews_comments = $prefix . '_interviews_comments';
    $pntable['interviews_comments'] = $interviews_comments;
    $pntable['interviews_comments_column'] = array ('cid'   => $interviews_comments . '.pn_cid',
                                                 'rid'      => $interviews_comments . '.pn_rid',
                                                 'userid'   => $interviews_comments . '.pn_userid',
                                                 'date'     => $interviews_comments . '.pn_date',
                                                 'comments' => $interviews_comments . '.pn_comments',
                                                 'score'    => $interviews_comments . '.pn_score');

    $interviews_main = $prefix . '_interviews_main';
    $pntable['interviews_main'] = $interviews_main;
    $pntable['interviews_main_column'] = array ('title'      => $interviews_main . '.pn_title',
                                            'description' => $interviews_main . '.pn_description');


    this is the function causing problems currently

    Code

    function interviews()
    {
         list($letter,
         $field,
         $order) = pnVarCleanFromInput('letter',
                       'field',
                       'order');

        switch($order) {
            case "DESC": break;
            case "ASC": break;
            default: $order=""; break;
        };


        list($dbconn) = pnDBGetConn();
        $pntable = pnDBGetTables();

        $interviews = $pntable['interviews'];
        $column = &$pntable['interviews_column'];

        $currentlang = pnUserGetLang();

        include ('header.php');
        if (pnConfigGetVar('multilingual') == 1) {
            $querylang = "AND ($column[language] ='$currentlang' OR $column[language] = '')";
        } else {
            $querylang = "";
        }
        $sitename = pnVarPrepForDisplay(pnConfigGetVar('sitename'));

        OpenTable();
        echo "<center><b>$sitename "._INTERVIEWS."</b><br>";
        if ($letter == _ALL) {
          $query = "SELECT $column[id], $column[title], $column[hits], $column[interviewer], $column[score]
                    FROM $interviews WHERE $column[id] != '' $querylang "
    ;
        } else {
          echo "<i>"._INTERVIEWSLETTER." \"".pnVarPrepForDisplay($letter)."\"</i><br><br>";
          $query = "SELECT $column[id], $column[title], $column[hits], $column[interviewer], $column[score]
                    FROM $interviews
                    WHERE UPPER($column[title]) LIKE '"
    .pnVarPrepForStore($letter)."%'
                    $querylang "
    ;
        }

        switch($field) {

            case "interviewer":
                $query .= " ORDER by pn_interviewer $order";
                break;

            case "score":
                $query .= " ORDER by pn_score $order";
                break;

            case "hits":
                $query .= " ORDER by pn_hits $order";
                break;

            default:
                $query .= " ORDER by pn_title $order";
                break;
        }

        $result = $dbconn->Execute($query);
        if ($result === false) {
            error_log("Error: " . $dbconn->ErrorNo() . ": " . $dbconn->ErrorMsg());
           PN_DBMsgError($dbconn, __file__, __line__, "Error accesing to the database");
        }
        if ($result->EOF) {
            echo '<font class="pn-normal"><i><b>'._NOINTERVIEWS.' \''.$letter.'\'</b></i></font><br><br>';
        } else {
            echo "<TABLE BORDER=\"0\" width=\"100%\" CELLPADDING=\"2\" CELLSPACING=\"4\">
                    <tr>
                    <td width=\"50%\" bgcolor=\"$GLOBALS[bgcolor4]\">
                    <P ALIGN=\"LEFT\"><a class=\"pn-normal\" href=\"modules.php?op=modload&amp;name=$GLOBALS[ModName]&amp;file=index&amp;req=$letter&amp;field=title&amp;order=ASC\"><img src=\"modules/$GLOBALS[ModName]/images/up.gif\" border=\"0\" width=\"15\" height=\"9\" Alt=\""
    ._SORTASC."\"></a><font class=\"pn-normal\"><B> "._PRODUCTTITLE." </B></font><a class=\"pn-normal\" href=\"modules.php?op=modload&amp;name=$GLOBALS[ModName]&amp;file=index&amp;req=$letter&amp;field=title&amp;order=DESC\"><img src=\"modules/$GLOBALS[ModName]/images/down.gif\" border=\"0\" width=\"15\" height=\"9\" Alt=\""._SORTDESC."\"></a>
                    </td>
                    <td width=\"18%\" bgcolor=\"$GLOBALS[bgcolor4]\">
                    <P ALIGN=\"CENTER\"><a class=\"pn-normal\" href=\"modules.php?op=modload&amp;name=$GLOBALS[ModName]&amp;file=index&amp;req=$letter&amp;field=interviewer&amp;order=ASC\"><img src=\"modules/$GLOBALS[ModName]/images/up.gif\" border=\"0\" width=\"15\" height=\"9\" Alt=\""
    ._SORTASC."\"></a><font class=\"pn-normal\"><B> "._INTERVIEWER." </B></font><a class=\"pn-normal\" href=\"modules.php?op=modload&amp;name=$GLOBALS[ModName]&amp;file=index&amp;req=$letter&amp;field=interviewer&amp;order=desc\"><img src=\"modules/$GLOBALS[ModName]/images/down.gif\" border=\"0\" width=\"15\" height=\"9\" Alt=\""._SORTDESC."\"></a>
                    </td>
                    </tr>"
    ;
            $numshown=0;
            while(!$result->EOF) {
                $myrow = $result->GetRowAssoc(false);
                $title = $myrow['pn_title'];
                $id = $myrow['pn_id'];
                $interviewer = $myrow['pn_interviewer'];
                if(!empty ($myrow['pn_email'])){
                    $email = $myrow['pn_email'];
                } else {
                  $email='';
                }
                $score = $myrow['pn_score'];
                $hits = $myrow['pn_hits'];

                if (pnSecAuthAction(0, 'Interviews::', "$title::$id", ACCESS_READ)) {
                    echo "<tr>
                            <td width=\"50%\" bgcolor=\"$GLOBALS[bgcolor4]\"><a class=\"pn-normal\" href=\"modules.php?op=modload&amp;name=$GLOBALS[ModName]&amp;file=index&amp;req=showcontent&amp;id=$id\">"
    .pnVarPrepForDisplay($title)."</a></td>
                            <td width=\"18%\" bgcolor=\"$GLOBALS[bgcolor4]\">"
    ;
                    if ($interviewer != "")
                        echo "<font class=\"pn-normal\"><center>".pnVarPrepForDisplay($interviewer)."</center></font>";
                   
                    echo   "</tr>";
                    $numshown++;
                }
            $result->MoveNext();
            }
            echo "</TABLE>";
            echo "<br><font class=\"pn-sub\">$numshown "._TOTALINTERVIEWS."</font><br><br>";
        }
        echo "[ <a class=\"pn-normal\"href=\"modules.php?op=modload&amp;name=$GLOBALS[ModName]&amp;file=index\">"._RETURN2MAIN."</a> ]</center>";
        /* memory flush */
        $result->Close();
        CloseTable();
        include ("footer.php");
    }



    now when i tell it to load like this by changing just the tables back to reviews, it works fine. why does changing the table name break the SQL? the tables exist and work fine in nearly every other function. and if it is a syntax error like it says it is why does it work fine when its loading the reviews? how can a table name effect the syntax of a statement?

    Code

    $interviews = $pntable['reviews'];
        $column = &$pntable['reviews_column'];

        $currentlang = pnUserGetLang();

        include ('header.php');
        if (pnConfigGetVar('multilingual') == 1) {
            $querylang = "AND ($column[language] ='$currentlang' OR $column[language] = '')";
        } else {
            $querylang = "";
        }
        $sitename = pnVarPrepForDisplay(pnConfigGetVar('sitename'));

        OpenTable();
        echo "<center><b>$sitename "._INTERVIEWS."</b><br>";
        if ($letter == _ALL) {
          $query = "SELECT $column[id], $column[title], $column[hits], $column[reviewer], $column[score]
                    FROM $interviews WHERE $column[id] != '' $querylang "
    ;
        } else {
          echo "<i>"._INTERVIEWSLETTER." \"".pnVarPrepForDisplay($letter)."\"</i><br><br>";
          $query = "SELECT $column[id], $column[title], $column[hits], $column[reviewer], $column[score]
                    FROM $interviews
                    WHERE UPPER($column[title]) LIKE '"
    .pnVarPrepForStore($letter)."%'
                    $querylang "
    ;
        }

        switch($field) {

            case "interviewer":
                $query .= " ORDER by pn_reviewer $order";
                break;
  • Posted: 02.10.2004, 15:02
     
    value2
    rank:
    Freshman Freshman
    registered:
     April 2004
    Status:
    offline
    last visit:
    05.10.04
    Posts:
    17
    93 views since june and only one response :P someone has to know whats going on
  • Posted: 02.10.2004, 16:01
     
    value2
    rank:
    Freshman Freshman
    registered:
     April 2004
    Status:
    offline
    last visit:
    05.10.04
    Posts:
    17
    ok, i fixed it and working perfectly.

Extensions Moderation

Main Menu

Extensions Database

Documentation

Development

Login

Donate to Zikula