Jump To Page

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Jump To Page

    ok, im having problerm putting the code 4 this. it always add +1 to the input number. if i put 5 in input box, i ended up to page 6. lolz.. eventhough i already put -1 to result, doesnt make any change. can ne1 lend me a help? look for

    //Go to page

    <?php

    $conf["items_per_page"] = 8;
    header("Pragma: no-cache");
    echo "<?xml version=\"1.0\"?>";
    echo "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\" \"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">";
    echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">";
    echo "<head>";
    echo "<title>Test</title>";
    echo "<meta http-equiv=\"cache-Control\" content=\"no-cache\" />";
    echo "<meta http-equiv=\"cache-Control\" content=\"must-revalidate\" />";
    echo "<meta http-equiv=\"content-type\" content=\"application/vnd.wap.xhtml+xml\" />";
    echo "<link rel=\"shortcut icon\" href=\"/images/favicon.ico\" type=\"image/x-icon\" />";
    echo "<style type=\"text/css\">";

    include (&#39;../../../test.php&#39;);

    if (!isset($page)) {$page = 0;}
    $total = 0;

    if(!($dp = opendir("./"))) die ("Cannot open ./");
    $file_array = array();
    while ($file = readdir ($dp))
    {
    if(substr($file,0,1) != &#39;.&#39; and $file != "index.php")
    {
    $file_array[] = $file;
    }
    }
    $file_count = count ($file_array);
    sort ($file_array);

    echo "</style></head><body>";
    echo "<div class=\"dir\">";

    include("../../../test.php");
    echo "
    </div>";
    echo "<div>Test
    ";
    echo &#39&#39;.($page+1).&#39;/&#39;.ceil($file_count/$conf["items_per_page"]).&#39;)
    </div>&#39;;
    echo "<div>";

    if ($file_count > 0)
    {
    $first_record = $page * $conf["items_per_page"];
    $last_record = $first_record + $conf["items_per_page"];
    while (list($fileIndexValue, $file_name) = each ($file_array))
    {
    if (($fileIndexValue >= $first_record) AND ($fileIndexValue < $last_record))
    {
    echo "$file_name
    ";
    echo "<a href=\"$file_name\">Download (". round(filesize($file_name)/1024,1) . "kb)</a>

    ";
    $total = $total + filesize($file_name);
    }
    }

    {echo &#39;
    </div>&#39;;
    echo &#39;<div>
    &#39;;
    include("../../../test.php");
    echo &#39;
    &#39;;
    }
    if (($file_count > 0) AND ($page != 0))
    {
    // previous button
    $prev_page = $page -1;
    echo "<a href=\"".$_SERVER["PHP_SELF"]."?page=$prev_page\"><<Prev</a> ";
    }
    if (($file_count > 0) AND ($last_record < $file_count))
    {
    // next button
    $next_page = $page + 1;
    echo "<a href=\"".$_SERVER["PHP_SELF"]."?page=$next_page\">Next>></a>";
    }
    echo "
    $file_count ";
    if ($file_count == 1)
    {echo "File";}
    else
    {echo "Files";}

    // Go to page
    { $page = $page - 1;
    echo "
    <form action=\"".$_SERVER["PHP_SELF"]."?page=$page\" method=\"get\">";
    echo "Jump to Page: <input name=\"page\" title=\"Page:\" size=\"3\" maxlength=\"2\"/>";
    echo "<input type=\"submit\" value=\"Go\"/>";
    echo "</form>";
    }

    echo "</small /></div>";
    echo &#39;<div class="dir"><small>&#39;;
    include("../../../test.php");
    echo "
    </div>";
    echo &#39;<div class="foot">&#39;;
    echo "<a href=\"/symbian/s60v1/index.php\">Test</a>";
    echo "
    <a href=\"../../../index.php\"><img alt=\"\" src=\"../../../images/home.gif\" />Home</a>";
    echo "
    ";
    echo "</div>";
    echo "</body>";
    }
    closedir($dp);
    echo "</xhtml>";
    ?>

    #2
    Code:
    if($pages>1)
    echo "
    <input emptyok=\"true\" name=\"jump\" format=\"*N\" size=\"3\" value=\"\" />
    <a href=\"".$_SERVER["PHP_SELF"]."?page=$(jump)&amp;sid=$sid\">Jump [1-$pages]</a>
    ";
    if ($page<$pages)
    {
    echo "<a href=\"".$_SERVER["PHP_SELF"]."?page=$pages&amp;sid=$sid\">Last Page</a>";
    }
    if ($page=="0" AND $file_count>$conf["items_per_page"]){
    echo "
    ";
    }
    if ($page>0)
    {
    echo "
    <small><a href=\"".$_SERVER["PHP_SELF"]."?page=0\">Home Page</a>";
    }
    Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
    Visit: WapMasterz Coming Back Soon!
    _______
    SCRIPTS FOR SALE BY SUBZERO
    Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
    FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
    _______
    Info & Tips
    php.net
    w3schools.com

    Comment


      #3
      change this little section
      Code:
      { $page = $page - 1;
      echo "
      <form action=\"".$_SERVER["PHP_SELF"]."?page=$page\" method=\"get\">";
      echo "Jump to Page: <input name=\"page\" title=\"Page:\" size=\"3\" maxlength=\"2\"/>";
      echo "<input type=\"submit\" value=\"Go\"/>";
      echo "</form>";
      }
      to
      Code:
      { 
      echo "
      <form action=\"".$_SERVER["PHP_SELF"]."\" method=\"get\">";
      echo "Jump to Page: <input name=\"page\" title=\"Page:\" size=\"3\" maxlength=\"2\"/>";
      echo "<input type=\"submit\" value=\"Go\"/>";
      echo "</form>";
      }

      Comment


        #4
        change this little section
        Code:
        { $page = $page - 1;
        echo "
        <form action=\"".$_SERVER["PHP_SELF"]."?page=$page\" method=\"get\">";
        echo "Jump to Page: <input name=\"page\" title=\"Page:\" size=\"3\" maxlength=\"2\"/>";
        echo "<input type=\"submit\" value=\"Go\"/>";
        echo "</form>";
        }
        to
        Code:
        { 
        echo "
        <form action=\"".$_SERVER["PHP_SELF"]."\" method=\"get\">";
        echo "Jump to Page: <input name=\"page\" title=\"Page:\" size=\"3\" maxlength=\"2\"/>";
        echo "<input type=\"submit\" value=\"Go\"/>";
        echo "</form>";
        }
        [/b]

        that wont work mate. it will add 1 i your input. if u put 6, you will end up in page 7. lolz. thats why i put $page -1 but still doesnt work. sub, thats to much, i just want the simple 1. lolz! will try it later. thanks to both of you anyway.

        Comment


          #5
          have u tried it? it will return whatever u put in the box as the page so if u put 9 it will reurn page.php?page=9

          Comment


            #6
            yup mate. have tried that 1 already. thats why i put $page-1 to $page to resolve the +1 result but still no luck.

            Comment


              #7
              Code:
              { 
              echo "
              <form action=\"".$PHP_SELF."\" method=\"get\">";
              echo "Jump to Page: <input name=\"page\" title=\"Page:\" size=\"3\" maxlength=\"2\"/>";
              echo "<input type=\"submit\" value=\"Go\"/>";
              echo "</form>";
              }

              try that with or out ".$PHP_SELF." to $PHP_SELF
              Visit: Chat4u.mobi - The New Lay Of being a site of your dreams!
              Visit: WapMasterz Coming Back Soon!
              _______
              SCRIPTS FOR SALE BY SUBZERO
              Chat4u Script : coding-talk.com/f28/chat4u-mobi-script-only-150-a-17677/ - > Best Script for your site no other can be hacked by sql or uploaders.
              FileShare Script : coding-talk.com/f28/file-wap-share-6596/ -> Uploader you will never regret buying yeah it mite be old now but it still seems to own others...
              _______
              Info & Tips
              php.net
              w3schools.com

              Comment


                #8
                add this line
                Code:
                if(isset($npage))$page=$npage-1;
                before:
                Code:
                if (!isset($page)) {$page = 0;}
                in your code, and than you can use this code as jum po page

                Code:
                echo &#39;<form action="&#39;.$_SERVER["PHP_SELF"].&#39;" method="get">&#39;
                          .&#39;Jump to Page: <input name="npage" title="Jump to Page:" size="3" maxlength="3"/>&#39;
                          .&#39;<input type="submit" value="Jump"/></form>&#39;;
                Advertise your mobile site for FREE with AdTwirl

                Comment


                  #9
                  i found out that its bcoz of (&#39;.($page+1).&#39;/&#39;.ceil($file_count/$conf["items_per_page"]).&#39;) thats why i thought its giving a result of +1 in jump page. lolz. the page that you are in have +1 but when you bookmark the page you are in, its actually the page that you input. eg. jump to page 6 will give you index.php?page=6 but the page display is page 7. lmao. neway, tnx 4 the help mates.

                  Comment

                  Working...
                  X