need a plugin to view all the page number. need a plugin to view all the page number.
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

need a plugin to view all the page number.

Started by fotovagu, October 12, 2006, 10:57:34 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

fotovagu

i have lot of pages in my albums. is there any plugin to view all the page numbers in a dropdown menu, like they have in phpBB?

Joachim Müller


Paver

This sounds like it could be done with a theme customization (maybe the "create_tabs" function).  I don't know what phpBB does, so if you have a link to show this, that would be helpful.


Paver

Here's a theme customization that should do what you want.

Add the following function to themes/yourtheme/theme.php:
function theme_create_tabs($items, $curr_page, $total_pages, $template)
{
        global $CONFIG, $lang_create_tabs;

        // Code for future: to implement 'previous' and 'next' tabs
        // Everything is set - just need to put in correct place and use correct prev & next page numbers
        // $tabs .= strtr( sprintf($template['inactive_prev_tab'],#PREV_PAGE_NUMBER#) , array('{PREV}' => $lang_create_tabs['previous']) );
        // $tabs .= strtr( sprintf($template['inactive_next_tab'],#NEXT_PAGE_NUMBER#) , array('{NEXT}' => $lang_create_tabs['next']) );

        $maxTab = $CONFIG['max_tabs'];

        $tabs_left = sprintf($template['left_text'], $items, $total_pages);
        if (($total_pages == 1)) return $tabs_left;

        $tabs = '';
        $tabs .= $template['tab_header'];
        if ($curr_page == 1) {
                $tabs .= sprintf($template['active_tab'], 1);
        } else {
                $tabs .= sprintf($template['inactive_tab'], 1, 1);
        }
        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;
        }

        $tabs_dropdown = '<td class="navmenu" style="white-space: nowrap">Go to page <select onChange="if (this.options[this.selectedIndex].value != -1) { window.location.href = this.options[this.selectedIndex].value; }">';
        for ($page = 1; $page <= $total_pages; $page++) {
                if (preg_match('#href="(.*)"#siU', sprintf($template['inactive_tab'], $page, $page) , $matches)) {
                        $tabs_dropdown .= '<option value="' . $matches[1] . '"'
                                . ($page == $curr_page ? ' selected="selected"' : '') . '>' . $page .'</option>';
                }
        }
        $tabs_dropdown .= '</select><img src="images/spacer.gif" width="4" height="1" alt="" /></td>';

        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 {
                        $tabs .= sprintf($template['inactive_tab'], $total_pages, $total_pages);
                }
        }
        return $tabs_left.$tabs_dropdown.$tabs.$template['tab_trailer'];
}


Moving this thread to the themes support board.

fotovagu

hi i know its been a long time since your post. i tried the above modification to my theme.php, when i apply that i dont see any page numbers.

could you please tell me where exactly i have to put these codes in the theme.php? im using hardwired theme

thank you inadvance  :)