### MOD Page_jump
### Author: Merlin Sythove
### Insert mini-edit box inside pagination to enter page to go to
### The idea of this edit box is that it is transparent and has no border.
### It will look like
### Go to page Previous 1, 2, 3 [ 18] >> 26, 27, 28 Next
### where the current page is in the edit box between the []
### Press enter in the box, or click on >>, to go to the wanted page
### IN CSS or in overall_header.tpl add the following style. Adjust it later.
input.pagination{
border:0px;
padding:0px;
font-size:9px;
width:20px;
}
### OPEN viewtopic_body.tpl
### ADD to TOP of page
<script language="javascript" type="text/javascript">
</script>
### FIND
{PAGINATION}
### REPLACE WITH (where necessary, I only have it at the bottom not at the top)
{PAGINATION_JUMP}
### OPEN
ViewTopic.php
### FIND
message_die(GENERAL_MESSAGE, 'Topic_post_not_exist');
}
### AFTER ADD
//START MOD Page_jump
$page = ( isset($HTTP_GET_VARS['page']) ) ? $HTTP_GET_VARS['page'] : 0 ;
if ($page) $start = ($page-1) * intval($board_config['posts_per_page']);
//END MOD Page_jump
### FIND (partial line)
$pagination = ( $highlight != '' ) ? generate_pagination
### AFTER the complete line add:
//START MOD Page_jump
$pagination_jump = ( $highlight != '' ) ? generate_pagination("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&postdays=$post_days&postorder=$post_order&highlight=$highlight", $total_replies, $board_config['posts_per_page'], $start, true, true) : generate_pagination("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&postdays=$post_days&postorder=$post_order", $total_replies, $board_config['posts_per_page'], $start, true, true);
$pagination_jump_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&postdays=$post_days&postorder=$post_order&highlight=$highlight");
//END MOD Page_jump
### FIND
'PAGINATION' => $pagination ,
### AFTER ADD
//START MOD Page_jump
'PAGINATION_JUMP' => $pagination_jump ,
'PAGINATION_JUMP_URL' => $pagination_jump_url,
//END MOD Page_jump
###OPEN
Functions.php
### FIND partial
function generate_pagination($base_url
### REPLACE whole line WITH
//EDIT MOD Page_jump
function generate_pagination($base_url, $num_items, $per_page, $start_item, $add_prevnext_text = TRUE, $insert_jump = FALSE)
### FIND (in the generate_pagination routine)
$page_string = '';
if ( $total_pages > 10 )
### REPLACE WITH
$page_string = '';
//START MOD Page_jump
if ($insert_jump && ($total_pages > 6) )
{
$d = 3; //show three items either side
for($i = 1; $i <=$d; $i++)
{
$page_string .= ( $i == $on_page ) ? '<b>' . $i . '</b>' : '<a class="pagination" href="' . append_sid($base_url . "&start=" . ( ( $i - 1 ) * $per_page ) ) . '">' . $i . '</a>';
if($i < $d) $page_string .= ", ";
}
$page_string .= ' [' . '<input id="pagejump" type="text" class="pagination" value="' . $on_page . '" onkeydown="javascript:if (event.keyCode==13) pj();"/>]';
$page_string .= ' <a class="pagination" href="javascript:pj()" >>></a> ';
for($i = $total_pages-$d+1; $i <= $total_pages; $i++)
{
$page_string .= ( $i == $on_page ) ? '<b>' . $i . '</b>' : '<a class="pagination" href="' . append_sid($base_url . "&start=" . ( ( $i - 1 ) * $per_page ) ) . '">' . $i . '</a>';
if( $i < $total_pages) $page_string .= ", ";
}
}
//END MOD Page_jump
else if ( $total_pages > 10 )
### EOM