Jump To Page

Started on the old forum in October 2007 · view the original in the archive · old links redirect here

8 replies · 656 views · started 19 years ago · 1 min read

3 participants
wapodium #1

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 ('../../../test.php');

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) != '.' and $file != "index.php") { $file_array[] = $file; } } $file_count = count ($file_array); sort ($file_array);

echo "</style></head><body>"; echo "";

include("../../../test.php"); echo ""; echo "Test "; echo '('.($page+1).'/'.ceil($file_count/$conf["items_per_page"]).') '; echo "";

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 ''; echo ' '; include("../../../test.php"); echo ' '; } 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 ""; echo ''; include("../../../test.php"); echo ""; echo ''; echo "<a href="/symbian/s60v1/index.php">Test</a>"; echo " <a href="../../../index.php"><img alt="" src="../../../images/home.gif" />Home</a>"; echo ""; echo ""; echo "</body>"; } closedir($dp); echo "</xhtml>"; ?>

subzero Super moderator Fellow · 3,954 posts #2
if($pages>1)
echo "
<input emptyok=\"true\" name=\"jump\" format=\"*N\" size=\"3\" value=\"\" />
<a href=\"".$_SERVER["PHP_SELF"]."?page=$(jump)&sid=$sid\">Jump [1-$pages]</a>
";
if ($page<$pages)
{
echo "<a href=\"".$_SERVER["PHP_SELF"]."?page=$pages&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... _______…

wizard Senior · 493 posts #3

change this little section

{ $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

{ 
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>";
}
wapodium #4

change this little section

{ $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

{ 
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>";
}

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.

wapodium #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.

subzero Super moderator Fellow · 3,954 posts #7
{ 
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... _______…

GumSlone Administrator Principal · 1,690 posts #8

add this line

if(isset($npage))$page=$npage-1;

before:

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

in your code, and than you can use this code as jum po page

echo '<form action="'.$_SERVER["PHP_SELF"].'" method="get">'
          .'Jump to Page: <input name="npage" title="Jump to Page:" size="3" maxlength="3"/>'
          .'<input type="submit" value="Jump"/></form>';

Advertise your mobile site for FREE with AdTwirl

External image (may be gone)

wapodium #9

i found out that its bcoz of ('.($page+1).'/'.ceil($file_count/$conf["items_per_page"]).') 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.

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close