PHP Web Host - Quality Web Hosting For All PHP Applications Sign up for PayPal and start accepting credit card payments instantly
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
rogue3
Regular
Regular


Joined: Jul 02, 2009
Posts: 63

PostPosted: Thu Oct 01, 2009 7:07 am Reply with quote Back to top

Hello!

I'm still tweaking this cool module. This time, I'm trying to add an "All" to the alphalist, so that when clicked on all reviews in the database are displayed. I've almost got it but am hung up on a few minor things.

1. Normally when I click on a letter, I get Reviews that begin with "A" displayed at the top. When I click on "All" I want it to say "All Reviews" but instead it says Reviews that begin with "%"

I added this, but it doesn't seem to be working:

Code:
    if($letter == All) {
    echo "<i>All Reviews</i><br><br>";
    }else {
    echo "<i>"._REVIEWSLETTER." \"$letter\"</i></font><br><br>";
    }


2. None of the sorting options (clicking the up/down arrows to sort a column) work on the All page. They work on all the letter pages, just not the all.

Here is the live page:
Only registered users can see links on this board!
Get registered or login to the forums!


Here is the complete function. Perhaps someone can shed some light on where I'm going wrong...

Code:
function alphalist($letter, $field, $order) {
    global $admin, $bgcolor4, $sitename, $prefix, $multilingual, $currentlang, $db, $module_name;
//    include ('header.php');
    $letter = substr("$letter", 0,1);
    if ($multilingual == 1) {
    $querylang = "AND rlanguage='$currentlang'";
    } else {
    $querylang = "";
    }
    OpenTable();
    echo "<font size=\"2\" face=\"Arial, Helvetica\"><center><b>Research Droids "._REVIEWS."</b><br>";
//    echo "<i>"._REVIEWSLETTER." \"$letter\"</i><br><br>";
    if($letter == All) {
    echo "<i>All Reviews</i><br><br>";
    }else {
    echo "<i>"._REVIEWSLETTER." \"$letter\"</i></font><br><br>";
    }
    switch ($field) {

   case "reviewer":
   $result = $db->sql_query("SELECT id, title, hits, reviewer, score, date FROM ".$prefix."_jreviews WHERE UPPER(title) LIKE '$letter%' $querylang ORDER by reviewer $order");
   break;

   case "id":
   $result = $db->sql_query("SELECT id, title, hits, reviewer, score, date FROM ".$prefix."_jreviews WHERE UPPER(title) LIKE '$letter%' $querylang ORDER by id $order");
   break;

   case "score":
   $result = $db->sql_query("SELECT id, title, hits, reviewer, score, date FROM ".$prefix."_jreviews WHERE UPPER(title) LIKE '$letter%' $querylang ORDER by score $order");
   break;

   case "hits":
   $result = $db->sql_query("SELECT id, title, hits, reviewer, score, date FROM ".$prefix."_jreviews WHERE UPPER(title) LIKE '$letter%' $querylang ORDER by hits $order");
   break;

   case "date":
   $result = $db->sql_query("SELECT id, title, hits, reviewer, score, date FROM ".$prefix."_jreviews WHERE UPPER(title) LIKE '$letter%' $querylang ORDER by date $order");
   break;

//   default:
//   $result = $db->sql_query("SELECT id, title, hits, reviewer, score FROM ".$prefix."_jreviews WHERE UPPER(title) LIKE '$letter%' $querylang ORDER by title $order");
//   break;

     default:
     if($letter == All) {
//     $result = $db->sql_query("SELECT id, title, hits, reviewer, score FROM ".$prefix."_jreviews ORDER by title ASC");
     $result = $db->sql_query("SELECT id, title, hits, reviewer, score, date FROM ".$prefix."_jreviews WHERE $querylang ORDER by title $order");
     }else {
     $result = $db->sql_query("SELECT id, title, hits, reviewer, score, date FROM ".$prefix."_jreviews WHERE UPPER(title) LIKE '$letter%' $querylang ORDER by title $order");
     }
     break;
    }
    $numresults = $db->sql_numrows($result);
    if ($numresults == 0) {
   echo "<font size=\"2\" face=\"Arial, Helvetica\"><i><b>"._NOREVIEWS."</b></i></font><br><br>";
    } elseif ($numresults > 0) {
   echo "<TABLE BORDER=\"0\" width=\"100%\" CELLPADDING=\"2\" CELLSPACING=\"4\">
      <tr>";

    if (is_admin($admin))
   echo "<td width=\"13%\" bgcolor=\"$bgcolor4\">
      <P ALIGN=\"CENTER\"><font size=\"2\" face=\"Arial, Helvetica\"><a href=\"modules.php?name=$module_name&amp;rop=$letter&amp;field=id&amp;order=ASC\"><img src=\"images/up.gif\" border=\"0\" width=\"11\" height=\"11\" Alt=\""._SORTASC."\"></a><B> "._ID." </B><a href=\"modules.php?name=$module_name&amp;rop=$letter&amp;field=id&amp;order=DESC\"><img src=\"images/down.gif\" border=\"0\" width=\"11\" height=\"11\" Alt=\""._SORTDESC."\"></a></font>
      </td>";

   echo "<td width=\"48%\" bgcolor=\"$bgcolor4\">
      <P ALIGN=\"LEFT\"><font size=\"2\" face=\"Arial, Helvetica\"><a href=\"modules.php?name=$module_name&amp;rop=$letter&amp;field=title&amp;order=ASC\"><img src=\"images/up.gif\" border=\"0\" width=\"11\" height=\"11\" Alt=\""._SORTASC."\"></a><B> "._PRODUCTTITLE." </B><a href=\"modules.php?name=$module_name&amp;rop=$letter&amp;field=title&amp;order=DESC\"><img src=\"images/down.gif\" border=\"0\" width=\"11\" height=\"11\" Alt=\""._SORTDESC."\"></a></font>
      </td>";

   echo "<td width=\"22%\" bgcolor=\"$bgcolor4\">
      <P ALIGN=\"CENTER\"><font size=\"2\" face=\"Arial, Helvetica\"><a href=\"modules.php?name=$module_name&amp;rop=$letter&amp;field=reviewer&amp;order=ASC\"><img src=\"images/up.gif\" border=\"0\" width=\"11\" height=\"11\" Alt=\""._SORTASC."\"></a><B> "._REVIEWER2." </B><a href=\"modules.php?name=$module_name&amp;rop=$letter&amp;field=reviewer&amp;order=desc\"><img src=\"images/down.gif\" border=\"0\" width=\"11\" height=\"11\" Alt=\""._SORTDESC."\"></a></font>
      </td>";

    if (is_admin($admin))
   echo "<td width=\"13%\" bgcolor=\"$bgcolor4\">
      <P ALIGN=\"CENTER\"><font size=\"2\" face=\"Arial, Helvetica\"><a href=\"modules.php?name=$module_name&amp;rop=$letter&amp;field=date&amp;order=ASC\"><img src=\"images/up.gif\" border=\"0\" width=\"11\" height=\"11\" Alt=\""._SORTASC."\"></a><B> "._ADDED2." </B><a href=\"modules.php?name=$module_name&amp;rop=$letter&amp;field=date&amp;order=DESC\"><img src=\"images/down.gif\" border=\"0\" width=\"11\" height=\"11\" Alt=\""._SORTDESC."\"></a></font>
      </td>";

    if (is_admin($admin))
   echo "<td width=\"13%\" bgcolor=\"$bgcolor4\">
      <P ALIGN=\"CENTER\"><font size=\"2\" face=\"Arial, Helvetica\"><a href=\"modules.php?name=$module_name&amp;rop=$letter&amp;field=hits&amp;order=ASC\"><img src=\"images/up.gif\" border=\"0\" width=\"11\" height=\"11\" Alt=\""._SORTASC."\"></a><B> "._HITS." </B><a href=\"modules.php?name=$module_name&amp;rop=$letter&amp;field=hits&amp;order=DESC\"><img src=\"images/down.gif\" border=\"0\" width=\"11\" height=\"11\" Alt=\""._SORTDESC."\"></a></font>
      </td>";

    if (is_admin($admin))
   echo "<td width=\"13%\" bgcolor=\"$bgcolor4\">
      <P ALIGN=\"CENTER\"><font size=\"2\" face=\"Arial, Helvetica\"><a href=\"modules.php?name=$module_name&amp;rop=$letter&amp;field=score&amp;order=ASC\"><img src=\"images/up.gif\" border=\"0\" width=\"11\" height=\"11\" Alt=\""._SORTASC."\"></a><B> "._RATING." </B><a href=\"modules.php?name=$module_name&amp;rop=$letter&amp;field=score&amp;order=DESC\"><img src=\"images/down.gif\" border=\"0\" width=\"11\" height=\"11\" Alt=\""._SORTDESC."\"></a></font>
      </td>";

   echo "<td width=\"17%\" bgcolor=\"$bgcolor4\">
      <P ALIGN=\"CENTER\"><font size=\"2\" face=\"Arial, Helvetica\"><a href=\"modules.php?name=$module_name&amp;rop=$letter&amp;field=score&amp;order=ASC\"><img src=\"images/up.gif\" border=\"0\" width=\"11\" height=\"11\" Alt=\""._SORTASC."\"></a><B> "._SCORE2." </B><a href=\"modules.php?name=$module_name&amp;rop=$letter&amp;field=score&amp;order=DESC\"><img src=\"images/down.gif\" border=\"0\" width=\"11\" height=\"11\" Alt=\""._SORTDESC."\"></a></font>
      </td>";



   echo "</tr>";
   while($myrow = $db->sql_fetchrow($result)) {
       $title = stripslashes(check_html($myrow["title"], "nohtml"));
       $id = intval($myrow['id']);
         $date = $myrow['date'];
    $year = substr($date,0,4);
      $month = substr($date,5,2);
     $day = substr($date,8,2);
     $fdate = date("F jS Y",mktime (0,0,0,$month,$day,$year));
        $reviewer = stripslashes($myrow['reviewer']);
        $email = stripslashes($myrow['email']);
       $score = intval($myrow['score']);
       $hits = intval($myrow['hits']);


       echo "<tr>";

    if (is_admin($admin))
       echo "</font></td><td width=\"13%\" bgcolor=\"#EEEEEE\"><font size=\"2\" face=\"Arial, Helvetica\"><center>$id</center></font></td>";

       echo "<td width=\"48%\" bgcolor=\"#EEEEEE\"><font size=\"2\" face=\"Arial, Helvetica\"><a href=\"modules.php?name=$module_name&rop=showcontent&amp;id=$id\">$title</a></font></td>";

       echo "<td width=\"22%\" bgcolor=\"#EEEEEE\"><center><font size=\"2\" face=\"Arial, Helvetica\">$reviewer</center></font></td>";

    if (is_admin($admin))
       echo "</font></td><td width=\"13%\" bgcolor=\"#EEEEEE\"><font size=\"2\" face=\"Arial, Helvetica\"><center>$fdate</center></font></td>";

    if (is_admin($admin))
       echo "</font></td><td width=\"13%\" bgcolor=\"#EEEEEE\"><font size=\"2\" face=\"Arial, Helvetica\"><center>$hits</center></font></td>";

    if (is_admin($admin))
       echo "</font></td><td width=\"13%\" bgcolor=\"#EEEEEE\"><font size=\"2\" face=\"Arial, Helvetica\"><center>$score</center></font></td>";

       echo "<td width=\"17%\" bgcolor=\"#EEEEEE\"><font size=\"2\" face=\"Arial, Helvetica\"><center>";
       display_score($score);



   }
   echo "</tr></TABLE>";
   echo "<font size=\"2\" face=\"Arial, Helvetica\"><br>$numresults "._TOTALREVIEWS."</font><br><br>";
    }
    echo "<font size=\"2\" face=\"Arial, Helvetica\"><a href=\"modules.php?name=$module_name\">"._RETURN2MAIN."</a></font>";
    CloseTable();
   
}


Here's the alpha function, in case there is something that needs to be adjusted in it:

Code:
function alpha() {
    global $module_name, $bgcolor2;
    $alphabet = array ("A","B","C","D","E","F","G","H","I","J","K","L","M",
//    $alphabet = array ("All","A","B","C","D","E","F","G","H","I","J","K","L","M",
                       "N","O","P","Q","R","S","T","U","V","W","X","Y","Z","1","2","3","4","5","6","7","8","9","0");
    $num = count($alphabet) - 1;
    echo "<center><font face=\"arial\" font size=\"2\">";
    $counter = 0;
    while (list(, $ltr) = each($alphabet)) {
        echo "<a href=\"modules.php?name=$module_name&rop=$ltr\">$ltr</a>";
        if ( $counter == round($num/2) ) {
            echo "\n<br>\n";
        } elseif ( $counter != $num ) {
            echo "&nbsp;|\n";
        }
        $counter++;
    }
//    echo " </center><br><table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\"><tr><td><font size=\"2\" face=\"Arial, Helvetica\"><img src=\"/images/spacer.gif\" width=\"15\" height=\"3\" /></font></td></tr><tr><td bgcolor=\"#dddddd\"/images/spacer.gif\" width=\"15\" height=\"1\"></td></tr><tr><td><font size=\"2\" face=\"Arial, Helvetica\"><img src=\"/images/spacer.gif\" width=\"15\" height=\"2\" /></font></td></tr></table>\n\n\n";
    echo "<br><br>";

   
}


Here is the only other place I refer to the 'All' down in the switches



Code:
   case "All":
   alphalist('%', $field, $order);
   break;
View user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2011 by Raven

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::
:: fisubice Theme Modified by the RavenNuke™ Team ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum