Jump to content


Photo

Help with a comment script!


  • Please log in to reply
No replies to this topic

#1 pepsymax

pepsymax
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 02 March 2006 - 08:46 PM

First i'll apologise as I know little about php, so bear with me if my explanation is not so good!

I've installed a php comment script (a script that allows my users to post a review on my php pages). I've installed it and it works.

However a little error occurs if I want the results to show up on more than one page. The problem is, the code is looking for a url ending with (.php). It then adds the code to forward to the next page directly after the php comment. My pages dont work as they end like this
index.php?&task=detail&id=7&mode=0&catid=45&navstart=0&search=*

The php comment in the code occurs too early on my pages, so the command to foward appears directly after php and forwards to the wrong page.

So! Instead of producing something like this...

index.php?&task=detail&id=7&mode=0&catid=45&navstart=0&search=*NEW_PAGE_CODE

It does this

index.php?NEW_PAGE_CODE

So I think the code tries to open the next page from (index.php) instead of from the end of the code (search*)

Now What I need is to rewrite the script so that it links after the (search=* ) comment.

Ok I think I've explained it... here is the code I have to change. Any ideas?

<?php

# configuration 
    $emptyMsg     = " Be the first to add comment to this page.";
    $size             = 40;    # size of input boxes 
    $cols             = 53; # width of text areas 
    $rows                = 5;    # height of text areas 

    $bgColor         = "#eaeaea";

# input box length adjustment code 
    $ie = stristr($HTTP_USER_AGENT, "MSIE") && true;
    $op = stristr($HTTP_USER_AGENT, "Opera") && true;
    $n6 = stristr($HTTP_USER_AGENT, "Netscape6") && true;
    $ns = (!($ie)) && (!($n6));
    $size = fw($size);
    $cols = fc($cols);

function fw($w) {
  global $ns;
  if ($ns == 1) { $w = $w * 0.8; }
  return ceil($w);
}

function fc($w) {
  global $n6;
  if ($n6 == 1) { $w = $w * 0.7; } else { $w = $w * 0.75; }
  return ceil($w);
}

# FUNCTIONS ###################################################################

# Calculate page navigation tool and define the lower and upper record numbers
    function genNav ($listID, $items, $ipp, &$lowLimit, &$topLimit) {
      $self = $_SERVER['PHP_SELF'];
        if (!isset($_GET['pID'])) { $pID = 0; } else { $pID = $_GET['pID']; }

        $str = "";
        $numberOfPages = ceil($items / $ipp);
        $lowLimit = $pID * $ipp;
        $topLimit = $lowLimit + $ipp;
        if ($topLimit > $items) { $topLimit = $items; }

        for ( $i=0; $i < $numberOfPages; $i++ ) {
            if ($i == $pID) {
                $str .= "<b>".($i+1)."</b> ";
            } else { $str .= "<a href=\"$self?pID=$i&listID=$listID#comment\">".($i+1)."</a> "; }
        }
        return $str;
    }
?>

If you need it the whole script can be found [a href=\"http://www.greatnexus.com/_downloads/commenter.php\" target=\"_blank\"]http://www.greatnexus.com/_downloads/commenter.php[/a]

Thanks

pep




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users