Did a quick search and hopefully, this is not a repeat. Newbie on this board but decided to give back to this great community. A while back, I saw in the existing 1.4.9 code stubs for "Prev" and "Next" in the image tab so I took a shot at coding it. So far it seems to work but I'm not positive it's gold. I'm sure somebody on here will fix it if it's not.
The code will make the tab look like this:
<Prev 1 ... 5 6 7 8 9 10 ... 320 Next>
theme.php
function theme_create_tabs($items, $curr_page, $total_pages, $template)
{
global $CONFIG, $lang_create_tabs;
$maxTab = $CONFIG['max_tabs'];
$tabs = sprintf($template['left_text'], $items, $total_pages);
if (($total_pages == 1))
return $tabs;
$tabs .= $template['tab_header'];
//start
$prev = $curr_page - 1;
$p = array('{PREV}' => $lang_create_tabs['previous']);
if ($prev < 1)
$tabs .= strtr( sprintf($template['active_prev_tab']), $p);
else
$tabs .= strtr( sprintf($template['inactive_prev_tab'],$prev), $p);
//end
if ($curr_page == 1) {
$tabs .= sprintf($template['active_tab'], 1);
} else {
$tabs .= sprintf($template['inactive_tab'], 1, 1);
if ($curr_page - floor($maxTab / 2) >= 2) //
$tabs .= $template['dotdotdot']; //
}
if ($total_pages > $maxTab){
$start = max(2, $curr_page - floor(($maxTab - 2) / 2));
$start = min($start, $total_pages - $maxTab + 2);
$end = $start + $maxTab - 3;
} else {
$start = 2;
$end = $total_pages - 1;
}
for ($page = $start; $page <= $end; $page++) {
if ($page == $curr_page) {
$tabs .= sprintf($template['active_tab'], $page);
} else {
$tabs .= sprintf($template['inactive_tab'], $page, $page);
}
}
if ($total_pages > 1) {
if ($curr_page == $total_pages) {
$tabs .= sprintf($template['active_tab'], $total_pages);
} else {
if ($curr_page + ($maxTab / 2) <= $total_pages) //
$tabs .= $template['dotdotdot']; //
$tabs .= sprintf($template['inactive_tab'], $total_pages, $total_pages);
}
}
//start
$next = $curr_page + 1;
$n = array('{NEXT}' => $lang_create_tabs['next']);
if ($next > $total_pages)
$tabs .= strtr( sprintf($template['active_next_tab']), $n);
else
$tabs .= strtr( sprintf($template['inactive_next_tab'],$next), $n);
//end
return $tabs . $template['tab_trailer'];
}
And the tab definitions are:
$template_tab_display = array(
'left_text' => '<td align="left" valign="middle" class="tableh1_compact" style="white-space: nowrap"><b>{LEFT_TEXT}</b></td>' . "\n",
'tab_header' => '',
'tab_trailer' => '',
'dotdotdot' => '<td align="center" valign="middle">...</td>',
'active_tab' => '<td align="center" valign="middle" class="navmenu_active">%d</td>',
'inactive_tab' => '<td align="center" valign="middle" class="navmenu"><a href="{LINK}"><b>%d</b></a></td>' . "\n",
'active_prev_tab' => '<td align="center" valign="middle" class="navmenu_active">{PREV}</td>' . "\n",
'inactive_prev_tab' => '<td align="center" valign="middle" class="navmenu"><a href="{LINK}"><b>{PREV}</b></a></td>' . "\n",
'active_next_tab' => '<td align="center" valign="middle" class="navmenu_active">{NEXT}</td>' . "\n",
'inactive_next_tab' => '<td align="center" valign="middle" class="navmenu"><a href="{LINK}"><b>{NEXT}</b></a></td>' . "\n",
);
english.php
$lang_create_tabs = array(
'previous' => '<Prev', //cpg1.4 //
'next' => 'Next>', //cpg1.4 //
);
If you're wondering why I removed the comments from the code above, it's because this is a family board and I tend to write odd comments in my code.
If I forgot to include something here, let me know. I wrote this a while ago so it's not so fresh in my memory anymore.
Also, I moved the navigation tabs to the top instead of the bottom. This way, a user can keep his/her cursor on the "Next" and keep clicking without having to move the cursor each time. Less work for the user.