 | [Solved] GoTO Specific Page MOD question. |  |
Posted: 05/09/2007 1:27 AM |
|
|
|
|
|
| Sparrow |
| Posts |
45 |
| Word Cnt. |
5,039 |
| BDay |
N/A |
| Sign |
N/A |
| Sex |
 |
|
|
|
Joined: Sep 24, 2006
Local time: 8:44 PM
|

|
|
|
|
 |
Hi,
I just installed this MOD and allthough it´s a simple as can be, I´m not able to see how I can put the dropdown after the normal pagination, like you put it on your board.
Can you tell me the trick?
Here´s the pagination part of functions.php:
| Code:
|
//
// Pagination routine, generates
// page number sequence
//
function generate_pagination($base_url, $num_items, $per_page, $start_item, $add_prevnext_text = TRUE)
{
global $lang;
$total_pages = ceil($num_items/$per_page);
if ( $total_pages == 1 )
{
return '';
}
$on_page = floor($start_item / $per_page) + 1;
$page_string = '';
if ( $total_pages > 10 )
{
$init_page_max = ( $total_pages > 3 ) ? 3 : $total_pages;
for($i = 1; $i < $init_page_max + 1; $i++)
{
$page_string .= ( $i == $on_page ) ? '<b>' . $i . '</b>' : '<a href="' . append_sid($base_url . "&start=" . ( ( $i - 1 ) * $per_page ) ) . '">' . $i . '</a>';
if ( $i < $init_page_max )
{
$page_string .= ", ";
}
}
if ( $total_pages > 3 )
{
if ( $on_page > 1 && $on_page < $total_pages )
{
$page_string .= ( $on_page > 5 ) ? ' ... ' : ', ';
$init_page_min = ( $on_page > 4 ) ? $on_page : 5;
$init_page_max = ( $on_page < $total_pages - 4 ) ? $on_page : $total_pages - 4;
for($i = $init_page_min - 1; $i < $init_page_max + 2; $i++)
{
$page_string .= ($i == $on_page) ? '<b>' . $i . '</b>' : '<a href="' . append_sid($base_url . "&start=" . ( ( $i - 1 ) * $per_page ) ) . '">' . $i . '</a>';
if ( $i < $init_page_max + 1 )
{
$page_string .= ', ';
}
}
$page_string .= ( $on_page < $total_pages - 4 ) ? ' ... ' : ', ';
}
else
{
$page_string .= ' ... ';
}
for($i = $total_pages - 2; $i < $total_pages + 1; $i++)
{
$page_string .= ( $i == $on_page ) ? '<b>' . $i . '</b>' : '<a href="' . append_sid($base_url . "&start=" . ( ( $i - 1 ) * $per_page ) ) . '">' . $i . '</a>';
if( $i < $total_pages )
{
$page_string .= ", ";
}
}
}
}
else
{
for($i = 1; $i < $total_pages + 1; $i++)
{
$page_string .= ( $i == $on_page ) ? '<b>' . $i . '</b>' : '<a href="' . append_sid($base_url . "&start=" . ( ( $i - 1 ) * $per_page ) ) . '">' . $i . '</a>';
if ( $i < $total_pages )
{
$page_string .= ', ';
}
}
}
if ( $add_prevnext_text )
{
if ( $on_page > 1 )
{
$page_string = ' <a href="' . append_sid($base_url . "&start=" . ( ( $on_page - 2 ) * $per_page ) ) . '">' . $lang['Previous'] . '</a> ' . $page_string;
}
if ( $on_page < $total_pages )
{
$page_string .= ' <a href="' . append_sid($base_url . "&start=" . ( $on_page * $per_page ) ) . '">' . $lang['Next'] . '</a>';
}
}
/// --- BEGIN MOD: Goto specific page
if ( $total_pages > 5 )
{
$select_page = ' <select name="generate_pagination" onChange="if(this.options[this.selectedIndex].value != -1){ window.location = this.options[this.selectedIndex].value; }">';
for($i = 1; $i <= $total_pages; $i++)
{
$selected = ( $i == $on_page ) ? ' selected="selected"' : ''; // highlight current page by default
$select_page .= '<option value="' . append_sid($base_url . "&start=" . ( ( $i - 1 ) * $per_page ) ) . '"' . $selected . '>' . $i . '</option>';
}
$select_page .= '</select>:';
}
else
$select_page = '';
/// --- END MOD: Goto specific page
$page_string = $lang['Goto_page'] . $select_page . ' ' . $page_string;
return $page_string;
}
|
|
|
|
 |
 |
| Back to Top |
|
|
 | Re: [Solved] GoTO Specific Page MOD question. |  |
Posted: 05/09/2007 10:04 AM |
|
|
|
|
|
| Citation |
| Posts |
407 |
| Word Cnt. |
10,993 |
| BDay |
May 28 |
| Sign |
Gemini |
| Sex |
 |
|
|
|
Joined: Feb 25, 2007
Local time: 6:44 PM
Location: SE England
|

|
|
|
|
 |
I'm guessing that you edit:
| Code:
|
|
/templates/template_name/viewtopic_body.tpl
|
Use a dropdown menu where you want the dropdown to be.
Sorry I couldn't be of any more help
/2¢
- Poomie |
|
|
 |
 |
| Back to Top |
|
|
 | Re: [Solved] GoTO Specific Page MOD question. |  |
Posted: 05/09/2007 4:01 PM |
|
|
|
|
|
| Sparrow |
| Posts |
45 |
| Word Cnt. |
5,039 |
| BDay |
N/A |
| Sign |
N/A |
| Sex |
 |
|
|
|
Joined: Sep 24, 2006
Local time: 8:44 PM
|

|
|
|
|
 |
Thanks Poomie,
What happens with this MOD is that the only edit it requieres is the one posted above, in functions.php.  |
|
|
 |
 |
| Back to Top |
|
|
 | Re: GoTO Specific Page MOD question. |  |
Posted: 05/10/2007 12:28 AM |
|
|
|
|
|
| Site Admin |
| Posts |
30757 |
| Word Cnt. |
2,628,690 |
| BDay |
Jul 28 |
| Sign |
Leo |
| Sex |
 |
|
|
|
Joined: Sep 25, 2004
Local time: 2:44 PM
Location: St Pete, FL
|

|
|
|
|
 |
This is how I did it:
OPEN
includes/functions.php
FIND
| Code:
|
|
$page_string = $lang['Goto_page'] . $select_page . ' ' . $page_string;
|
REPLACE WITH
| Code:
|
|
$page_string = $lang['Goto_page'] . ': ' . $page_string . ' ' . $select_page;
|
Save and upload back to the includes folder. Make sure that you created a good backup of your current functions.php file before you overwrite it with this modified version...
 |
|
|
 |
 |
| Back to Top |
|
|
 | Re: [Solved] GoTO Specific Page MOD question. |  |
Posted: 05/10/2007 2:01 AM |
|
|
|
|
|
| Sparrow |
| Posts |
45 |
| Word Cnt. |
5,039 |
| BDay |
N/A |
| Sign |
N/A |
| Sex |
 |
|
|
|
Joined: Sep 24, 2006
Local time: 8:44 PM
|

|
|
|
|
 |
That was it,
Now when I look at the change I see what I didn´t on my own.
Nice job, thanks, have a nice day!  |
|
|
 |
 |
| Back to Top |
|
|
 | Re: GoTO Specific Page MOD question. |  |
Posted: 05/10/2007 2:08 AM |
|
|
|
|
|
| Site Admin |
| Posts |
30757 |
| Word Cnt. |
2,628,690 |
| BDay |
Jul 28 |
| Sign |
Leo |
| Sex |
 |
|
|
|
Joined: Sep 25, 2004
Local time: 2:44 PM
Location: St Pete, FL
|

|
|
|
|
 |
It wasn't immediately obvious of what to do. But now that you have seen the change, it can look that way...
I'm glad that worked for you...
 |
|
|
 |
 |
| Back to Top |
|
|
 | Information |  |
|