add 'previous' and 'next' to page tabs. - Page 4 add 'previous' and 'next' to page tabs. - Page 4
 

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

add 'previous' and 'next' to page tabs.

Started by yoshikiwei, July 22, 2004, 07:26:15 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

net

Anyone who has successfully added this hack to theme "chaoticsoul" http://forum.coppermine-gallery.net/index.php/topic,39753.0.html

I've tried to but i cannot get it to work, any ideas?

Thanks.

Gizmo

Did you read the manual first???? Taking 2 minutes to backup your files can save you hours of wondering what you screwed up.
Billy Bullock - BullsEyePhotos Blog of Indecision

Oli_Pavitt

Guys have this code working apart from the front page when the URL reads http://www.mysite.co.uk/pictures/index.php. If the URL reads http://www.mysite.co.uk/pictures//index.php?cat=2&page=1 then the code works.

Anyone know how to get the code to work when its running as just the index.php address?

Coppermine Photo Gallery 1.4.18
Edited: functions.inc.php as per 1st page.

Have not edited my themes.inc.php as adding the changes noted causes the add on to fail.

Hope you can help, Oli

Paver

FYI: Previous and next tabs, plus a dropdown list of all pages has been added to the upcoming 1.5 version.  You can check out the code using Subversion (SVN), but it's still alpha so don't use 1.5 on production sites.  You can look at what was done in $template_tab_display and function theme_create_tabs in the sample theme and see if it works in 1.4.x.  I haven't tested that and don't plan to as we are all working hard on 1.5.

This is just a notice.  I will not be providing any support as this is a "No Support" board.

Ludo

#64
I've read the whole thread and there seems to be a bit of mess about how to accomplish previous and next tabs.
As of today (CPG 1.4.20), the one and only edit needed is to copy and paste the following function just before the end of themes/your_theme/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'];
        if ($curr_page == 1) {
                $tabs .= sprintf($template['active_tab'], 1);
        } else {
                if ($curr_page > 1) $tabs .= strtr( sprintf($template['inactive_prev_tab'], $curr_page-1) , array('{PREV}' => $lang_create_tabs['previous']) );         
                $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;
        }
        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);
                        $tabs .= strtr( sprintf($template['inactive_next_tab'], $curr_page+1) , array('{NEXT}' => $lang_create_tabs['next']) );                       
                }
        }
        return $tabs.$template['tab_trailer'];
}

I'm using this mod in my gallery without any trouble, so far.