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

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

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 5 Guests are viewing this topic.

Tranz

Quote from: CypherBit on February 11, 2006, 07:33:15 PM
But I have a problem validating it: http://www.cypherbit.com/coppermine/ I get two errors: http://validator.w3.org/check?uri=http://www.cypherbit.com/coppermine/ anyone able to fix this?

You need to change & to & wherever it is used in a URL.

Example:
        $theme_thumb_tab_tmpl['inactive_next_tab'] = strtr($theme_thumb_tab_tmpl['inactive_next_tab'], array('{LINK}' => 'thumbnails.php?album=' . $aid . $cat_link . '&page=%d'));
        $theme_thumb_tab_tmpl['inactive_prev_tab'] = strtr($theme_thumb_tab_tmpl['inactive_prev_tab'], array('{LINK}' => 'thumbnails.php?album=' . $aid . $cat_link . '&page=%d'));


becomes

        $theme_thumb_tab_tmpl['inactive_next_tab'] = strtr($theme_thumb_tab_tmpl['inactive_next_tab'], array('{LINK}' => 'thumbnails.php?album=' . $aid . $cat_link . '&page=%d'));
        $theme_thumb_tab_tmpl['inactive_prev_tab'] = strtr($theme_thumb_tab_tmpl['inactive_prev_tab'], array('{LINK}' => 'thumbnails.php?album=' . $aid . $cat_link . '&page=%d'));


I'm just guessing... I don't use the mod so I haven't tested.

CypherBit

Good "guesswork".
I replaced all instances of & with & and it validates just fine. Thank you TranzNDance.

Tranz


Gephri

Using "eyeball" template and can not find the code you reference for yourtheme.php.

The functions.inc.php replaced easily - but not sure how to update the theme.php.

THoTH_2005

Quote from: AWJunkies on January 30, 2006, 06:23:46 AM
Yep works perfect for 1.4.3

Most of the editing is already done with theme.inc.php, very easy mod takes 2 minutes if that.

Can you tell us how? I tried modifying the theme.inc.php and the functions file as per the original post, all I ended up with was a white screen. Could someone be kind enough to post an attachment to replace the files for the latest version. Can the page numbers be extended. If there are several hundred images in an album, it's a pain to have to click through them individually to get to the one you need.

A longer range like 1-10 or 1-60 or something would be useful as well as a "previous" and "next"
All wisdom is contained in The Book Of THoTH

nicedreams

Works well with 1.4.3.

Change the function in the functions.inc.php as stated. And do most of what it says for your themes.inc.php file. Some of the additions are already there. Easy to do, got it done in less than 5 minutes and even after some wine.  ;)

Jim

THoTH_2005

Quote from: nicedreams on March 03, 2006, 01:15:24 AM
Works well with 1.4.3.

Change the function in the functions.inc.php as stated. And do most of what it says for your themes.inc.php file. Some of the additions are already there. Easy to do, got it done in less than 5 minutes and even after some wine.  ;)

Jim

I'm allergic to wine  ;D stated where? do most of what, what says? after the mention of 1.4.3 I just see code to tidy up the output?
All wisdom is contained in The Book Of THoTH

lordprodigy

I saw some of this code left over in the sample theme.php in version 1.4.4. Can this be used with that version of there is still problems with the index page? Thanks in advance.


akulion

Wow reallly old topic

Will this work with 1.4.9 ?

I really terribly terribly need this feature.

Or an alternative would be having something like the pages seperated by dont only showing the 1st few and the last few like so:

1 | 2 | 3........49 | 50 | 51

however I prefr the next and back buttons :D

Can someone help out with this please?
Thanks :)

Aku


Joachim Müller

Quote from: akulion on October 24, 2006, 06:53:50 AM
Will this work with 1.4.9 ?
Why don't you try it and tell us? It should work, but hasn't been tested.

akulion

Thanks for the suggestion :D I was afraid of messing something up big time lol

Works for 1.4.9

All that you have to do is modify the functions.inc.php in your includes folder.

The rest of the code it already present in all the other files :D

Aku

Hein Traag

I edited functions.ini.php of my 1.4.10 CPG and did not get a NEXT but a {NEXT}

Read through the thread but no clue what i did or did not do to get this.

I need a hint ;)

Cheers!
Hein

Gephri

I also have this same problem
Quoteedited functions.ini.php of my 1.4.10 CPG and did not get a NEXT but a {NEXT}

Could someone please post a solution - or direct me towards the problem, then if I solve it I'll post it.

Thanks

Air_Cooled_Nut

Works for version 1.4.10
My album:  http://www.icbm.org/cmgallery/

Edit the file:  ... / cmgallery / include / functions.inc.php
There is code for this functionality in the functions.inc.php file, commented out, but it doesn't work.  I simply followed the instructions on the first page for replacing the create_tabs function (find, copy, replace).  No need to touch any other files :)

mireille

Quote from: Hein on November 16, 2006, 04:27:39 PM
I edited functions.ini.php of my 1.4.10 CPG and did not get a NEXT but a {NEXT}

Read through the thread but no clue what i did or did not do to get this.

I need a hint ;)

Cheers!
Hein

Quote from: Gephri on December 11, 2006, 05:27:26 AM
I also have this same problem
Could someone please post a solution - or direct me towards the problem, then if I solve it I'll post it.

Thanks

I don't know if anyone still cares but this is what I did:

in yourtheme.php, look for
// Template used for tabbed display
$template_tab_display = array('left_text' => '<td width="100%%" align="left" valign="middle" class="tableh1_compact" style="white-space: nowrap"><b>{LEFT_TEXT}</b></td>' . "\n",
    'tab_header' => '',
    'tab_trailer' => '',
    'active_tab' => '<td><img src="images/spacer.gif" width="1" height="1" alt="" /></td>' . "\n" . '<td align="center" valign="middle" class="tableb_compact"><b>%d</b></td>',
    'inactive_tab' => '<td><img src="images/spacer.gif" width="1" height="1" alt="" /></td>' . "\n" . '<td align="center" valign="middle" class="navmenu"><a href="{LINK}"><b>%d</b></a></td>' . "\n",
    'inactive_prev_tab' => '<td><img src="images/spacer.gif" width="1" height="1" alt="" /></td>' . "\n" . '<td align="center" valign="middle" class="navmenu"><a href="{LINK}"><b>{PREV}</b></a></td>' . "\n",
   'inactive_next_tab' => '<td><img src="images/spacer.gif" width="1" height="1" alt="" /></td>' . "\n" . '<td align="center" valign="middle" class="navmenu"><a href="{LINK}"><b>{NEXT}</b></a></td>' . "\n",
);


If you scroll to the right side you see {PREV} and {NEXT}. Simply change this to "Previous" and "Next."

// Template used for tabbed display
$template_tab_display = array('left_text' => '<td width="100%%" align="left" valign="middle" class="tableh1_compact" style="white-space: nowrap"><b>{LEFT_TEXT}</b></td>' . "\n",
    'tab_header' => '',
    'tab_trailer' => '',
    'active_tab' => '<td><img src="images/spacer.gif" width="1" height="1" alt="" /></td>' . "\n" . '<td align="center" valign="middle" class="tableb_compact"><b>%d</b></td>',
    'inactive_tab' => '<td><img src="images/spacer.gif" width="1" height="1" alt="" /></td>' . "\n" . '<td align="center" valign="middle" class="navmenu"><a href="{LINK}"><b>%d</b></a></td>' . "\n",
    'inactive_prev_tab' => '<td><img src="images/spacer.gif" width="1" height="1" alt="" /></td>' . "\n" . '<td align="center" valign="middle" class="navmenu"><a href="{LINK}"><b>Previous</b></a></td>' . "\n",
   'inactive_next_tab' => '<td><img src="images/spacer.gif" width="1" height="1" alt="" /></td>' . "\n" . '<td align="center" valign="middle" class="navmenu"><a href="{LINK}"><b>Next</b></a></td>' . "\n",
);

mireille

Is it possible to show less number tabs between [previous] and [next]?

Example:

[previous] 1,2,3,4,5,6,7,8,20,21,22,23 [next]

to

[previous] 1,2,3,4,5,23 [next]

Stramm

Quote from: mireille on August 21, 2007, 03:01:54 PM
Is it possible to show less number tabs between [previous] and [next]?

That's a config option
http://coppermine-gallery.net/demo/cpg14x/docs/index.htm#admin_thumbnail_view
QuoteMaximum number of tabs to display

When the thumbnails spread over multiple pages, tabs are displayed at the bottom of the page. This value define how many tabs will be displayed.

jesusarmy

Quote from: GauGau on December 19, 2004, 04:37:45 PM
added the mod to the cpg1.4.x code, but it was causing issues on the index page, that's why I removed it again. Will need looking into - for now, I won't add it.

Joachim

One step of the mod has to be applied twice in your theme.php, in function theme_display_album_list_cat (display first level Albums of a category) as well as function theme_display_album_list (display Album list) in order to work correctly on the index page.

That is, after

    $theme_alb_list_tab_tmpl['left_text'] = strtr($theme_alb_list_tab_tmpl['left_text'], array('{LEFT_TEXT}' => $lang_album_list['album_on_page']));
    $theme_alb_list_tab_tmpl['inactive_tab'] = strtr($theme_alb_list_tab_tmpl['inactive_tab'], array('{LINK}' => 'index.php?cat=' . $cat . '&amp;page=%d'));


add

    $theme_alb_list_tab_tmpl['inactive_next_tab'] = strtr($theme_alb_list_tab_tmpl['inactive_next_tab'], array('{LINK}' => 'index.php?cat=' . $cat . '&amp;page=%d'));
    $theme_alb_list_tab_tmpl['inactive_prev_tab'] = strtr($theme_alb_list_tab_tmpl['inactive_prev_tab'], array('{LINK}' => 'index.php?cat=' . $cat . '&amp;page=%d'));


and then do the same again in the function theme_display_album_list_cat

Darren_S

I've successfully implemented this hack into Coppermine v1.4.18 -- the trick here is that "yourtemplate.php" apparently no longer exists.  (It looks like the PREV / NEXT tab functionality is being built into the code, but hasn't yet debuted as the default or as a Config option.)

Open include/functions.inc.php and replace the full function as indicated in post #3 of this thread.  Find:

function create_tabs($items, $curr_page, $total_pages, $template)
{
        global $CONFIG, $lang_create_tabs;

        // TO-DO: Need to add theme_create_tabs() to sample/theme.php
        // Maybe this function create_tabs() should be moved to themes.inc.php and renamed theme_create_tabs()?
        if (function_exists('theme_create_tabs')) {
            return theme_create_tabs($items, $curr_page, $total_pages, $template);
        }

        // 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 = 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 {
                $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);
                }
        }
        return $tabs.$template['tab_trailer'];
}


... and replace with:

function create_tabs($items, $curr_page, $total_pages, $template)
{
        global $CONFIG;

        if (function_exists('theme_create_tabs')) {
            theme_create_tabs($items, $curr_page, $total_pages, $template);
                return;
        }

        $maxTab = $CONFIG['max_tabs'];

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

        $tabs .= $template['tab_header'];

        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;
        }
//display prev page tab
if ($curr_page != ($start-1)) {
$tabs .= sprintf($template['inactive_prev_tab'], $curr_page-1, "Prev");
} else {
$tabs .= sprintf($template['active_prev_tab'], "Prev");
}

        if ($curr_page == 1) {
                $tabs .= sprintf($template['active_tab'], 1);
        } else {
                $tabs .= sprintf($template['inactive_tab'], 1, 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);
                }
        }
//display next page tab
if ($curr_page != $total_pages) {
$tabs .= sprintf($template['inactive_next_tab'], $curr_page+1, "Next");
} else {
$tabs .= sprintf($template['active_next_tab'], "Next");
}

        return $tabs.$template['tab_trailer'];
}



Then, open includes/themes.inc.php and replace {PREV} with PREV and {NEXT} with NEXT (or however you want to style them) to get rid of the curly brackets.

Thanks, everyone!

Joachim Müller

Quote from: Darren_S on May 31, 2008, 10:57:40 PM
the trick here is that "yourtemplate.php" apparently no longer exists.
Never existed, in no version ever. What is meant is the file themes/yourtheme/theme.php ("yourtheme" being a placeholder for the name of the theme that you actually use. Don't edit include/themes.inc.php!