jump to comments page drop down box, instead of horizontal l

Dr. GBooky is here to help you with your guestbook problems ...
Post Reply
Mr Man

jump to comments page drop down box, instead of horizontal l

Post by Mr Man »

Script URL:
Version of script:
Version of PHP:
Hosting company:
Have you searched THIS FORUM for your problem:
(if not please do before posting)
If so, what terms did you try:

Write your message below:

Hello, all, been looking at your script and i like it, just wanted to know if there was an easier solution than a recordset to make a jump to drop down box for page numbers, as the list can get quite long sometimes, hence altering page widths and heights. (i.e I dont know how to load the menu contents dynamically)

Any Iota of a clue would be most appreciated.

:D
Henrie
Posts: 1095
Joined: Sun Aug 14, 2005 8:57 pm

Post by Henrie »

Hello Mr Man

If I understand you right you want a drop-down box to change pages. To do this you have to change the gbook.php (version 1.34) file.

The following changes must be made:
Find line 627

Code: Select all

</head>
And change it to:

Code: Select all

<script type="text/javascript">
<!--
function jumpBox(list) {
  location.href = list.options[list.selectedIndex].value
}
-->
</script>
</head>
Find the following code (around line 127) to change the numbers at the top of the page

Code: Select all

echo '<p>Displaying page '.$page.' of '.$pages.'. Pages: ';
	for ($i=1; $i<=$pages; $i++) {
		if($i == $page) {echo "<b>$i</b>\n";}
        else {echo '<a href="gbook.php?page='.$i.'">'.$i.'</a> ';}
	}
}

echo '</p>
and change it to this:

Code: Select all

echo '<p>Displaying page '.$page.' of '.$pages.'. <form>Choose page: <select>';
	for ($i=1; $i<=$pages; $i++) {
		if($i == $page) {echo "<option selected>$i\n";}
        else {echo '<option value="gbook.php?page='.$i.'">'.$i;}
	}
}

echo '</select><input type="button" value="Go" onClick="jumpBox(this.form.elements[0])"></form></p>
Find the following code (around line 147) to change the numbers at the bottom of the page

Code: Select all

echo '<p>Pages: ';
	for ($i=1; $i<=$pages; $i++) {
		if($i == $page) {echo "<b>$i</b>\n";}
        else {echo '<a href="gbook.php?page='.$i.'">'.$i.'</a> ';}
	}
}
and change it to this:

Code: Select all

echo '<form>Choose page: <select>';
	for ($i=1; $i<=$pages; $i++) {
		if($i == $page) {echo "<option selected>$i\n";}
        else {echo '<option value="gbook.php?page='.$i.'">'.$i;}
	}
}
echo '</select><input type="button" value="Go" onClick="jumpBox(this.form.elements[0])"></form></p>';
Greetings,
Henrie
Henrie
Posts: 1095
Joined: Sun Aug 14, 2005 8:57 pm

Post by Henrie »

A small improvement on my previous posted script to change the page immediately after selecting the page without having to push a go button.

Change the code (around line 127) to change the numbers at the top of the page to this instead of the previous suggested code:

Code: Select all

echo '<p>Displaying page '.$page.' of '.$pages.'. <form>Choose page: <select onChange="jumpBox(this.form.elements[0])">';
	for ($i=1; $i<=$pages; $i++) {
		if($i == $page) {echo "<option selected>$i\n";}
        else {echo '<option value="gbook.php?page='.$i.'">'.$i;}
	}
}

echo '</select></form></p>
Change the code (around line 147) to change the numbers at the bottom of the page to this instead of the previous suggested code:

Code: Select all

echo '<form>Choose page: <select onChange="jumpBox(this.form.elements[0])">';
	for ($i=1; $i<=$pages; $i++) {
		if($i == $page) {echo "<option selected>$i\n";}
        else {echo '<option value="gbook.php?page='.$i.'">'.$i;}
	}
}
echo '</select></form></p>';
Greetings,
Henrie
Mr Man

Post by Mr Man »

Code: Select all

Superbly Done
Post Reply