Fork me on GitHub

How to port this center display to .723?  Bottom

  • Currently, I am using the old .7x system on my site and have a customized theme that utilizes the Barhaini structure, in that it displays recent topics, etc in the center area. It can be seen here: http://www.pcmodeler.com

    I would like to port that same idea over to .723, but with the changes in the way the database is accessed, it doesn't work as a straight copy/paste.

    Here is an example of the code:

    Code

    function themecenterbox($title, $content) {
        echo "<table width=\"100%\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">"
        ."<tr><td>"
        ."<b><font class=\"pn-normal\">$title</font></b></td></tr>"
        ."<tr><td>"
        ."<font class=\"pn-sub\">";
        if (file_exists($content)) {
            $fp = fopen ($content, "r");
            $content = fread($fp, filesize($content));
            fclose ($fp);
            $content = "?><font class=\"pn-normal\">$content</font><?";
            echo eval($content);
        } else {
            echo $content;
        }
        echo "</font>"
        ."</td></tr></table><br>";
    }

    function recentheadlines() {
        global $pntable;
        $query="SELECT pn_sid, pn_title, left(time,10) FROM $pntable[stories] ORDER BY time DESC LIMIT 5";
        $result=mysql_query($query);
        $title .= "<FONT class=\"pn-title\"><A href=search.php?min=32&type=stories&category=><img src=\"themes/pcmodeler/images/latest_news.gif\" width=\"96\" height=\"14\" alt=\"Show me the News\" border=\"0\"></A></FONT>";
        $title .= "<FONT class=\"pn-tiny\"><A href=modules.php?op=modload&name=Submit_News&file=index><img src=\"themes/pcmodeler/images/submit_news.gif\" width=\"116\" height=\"14\" alt=\"Submit a News Item\" border=\"0\"></A></FONT>";
        while (list($sid, $headlinetitle, $time) = mysql_fetch_row($result)) {
            if(strlen($headlinetitle) > 35) {
                $headlinetitle = substr($headlinetitle,0,35);
                $headlinetitle .= "..";
            }
            $content .= "<dt><FONT class=pn-tiny><img src=\"themes/pcmodeler/images/tag.gif\" width=\"10\" height=\"10\"border=\"0\">[$time] <A href=modules.php?op=modload&name=News&file=article&sid=$sid>$headlinetitle</A></FONT>";
        }
        themecenterbox($title, $content);
    }


    It is then called by placing recentheadlines() in the body.

    I get the following error in .723.

    Code

    mysql_fetch_row(): supplied argument is not a valid mysql result resource in /home/www/pcmodeler/phoenix/themes/V-Sport/theme.php on line 218


    Line 218 has this:

    Code

    while (list($sid, $headlinetitle, $time) = mysql_fetch_row($result)) {
  • Happened to me on plenty of themes from PHP5_ML_Themes_PN package, esp. when I installed them on PN 0.7.2.3

    If you get error

    mysql_fetch_row(): supplied argument is not a valid MySQL result resource in ..../themes/SomeThemeName/theme.php on line XX

    look one line before the one containing the call to mysql_fetch_row() /or the first line above it that specifies the actual SQL statement/.

    Almost for sure, the SQL statement contains wrong, incorrect field names !

    Most probably, esp. if you upgraded the postnuke version, the names of the fields are missing the prefix "pn_" in front of them.

    Add the prefix in front of all fields in the SQL statement.

    Worked like a charm for me!

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