Loading ...
Sorry, an error occurred while loading the content.

Pagination for results? I am lost.

Expand Messages
  • chalitame
    Hi everyone, It s been a little while since I have posted here. last time I posted I iquired about html templating. It s hard to contribute considering I don t
    Message 1 of 1 , Oct 3, 2005
    • 0 Attachment
      Hi everyone,

      It's been a little while since I have posted here. last time I posted
      I iquired about html templating. It's hard to contribute considering I
      don't know what I am doing most of time.

      I have a something I want to do with search results on a script, I
      want to have it so there would be page numbers to click on in the
      results page. ie... 1 - 2 - 3 - 4 etc... and have like 10 pages max
      and would not show the 11th page number until they were at page 10 and
      the next group of 10 pages would show up... something like google has it.

      I searched online for something to help and looked at a few scripts I
      thought may have a little snippet to gleam some use out of nothing.
      It's probably a really simple thing with some math of course, I am
      nearly in tears over this I don't know how to do it.

      Any suggestions, snippets or scripts to look at to understand how to
      go about it?
      (please keep in mind I am learning a little here a
      little there.)
      &print item is the content for the search results.

      This is what I am working with:

      my($SIZE,$i);
      my(@LINES)=<FILE>;
      close(FILE);
      $SIZE=@LINES;
      if ($sub_command eq 'all') {
      my($max) = $position + $numtolist;
      if ($max > $SIZE) {$max = $SIZE;}
      for ($i=$position;$i<$max;$i++) {
      $_=$LINES[$i];
      ($itemid, $name, $price, $descrip, $image, $weight, $itemurl,
      $group, $shipping2, $Item_var_one, $handling, $custom, $Item_var_two,
      $idle_2, $shipping, $idle_3) = split(/\|/,$_);
      &print_item;
      }

      if ($max < $SIZE) {
      print "<a
      href=\"$cart_script\?command=listitems\&position=$max&sub_command=all\">\n";
      $left=$SIZE-$max;
      if ($left<$numtolist) {print "Last $left ";}
      else{print "Next $numtolist ";}
      print "of $SIZE Items</a>\n";
      }
      }
      elsif ($sub_command eq 'search') {
      my($matches) = 0;
      my($i) = $position;
      while (($matches < $numtolist) && ($i < $SIZE)) {
      $_=$LINES[$i];
      if (index(lc $LINES[$i],lc $FORM{'search'}) >= 0) {
      $matches++;
      ($itemid, $name, $price, $descrip, $image, $weight, $itemurl,
      $group, $shipping2, $Item_var_one, $handling, $custom, $Item_var_two,
      $idle_2, $shipping, $helpvoice) = split(/\|/,$_);
      &print_item;
      }
      $i++;
      }
      print "</table>\n";
      print "</td></tr></table></center>\n";

      if ($i < $SIZE) {
      print "<tr valign=\"top\"><td><form method=POST
      action=\"$cart_script\?command=listitems\&position=$i\&sub_command=search\">\n";

      print "<input type=hidden name=itemid value=\"$itemid\">\n";
      print "<input type=hidden name=search value=\"$FORM{'search'}\">\n";
      print "<center><input type=submit value=\"Next
      Items\"></center></form></td></tr>\n";

      }
      }


      Any help or direction would be greatly appreciated.

      Chalita
    Your message has been successfully submitted and would be delivered to recipients shortly.