Advanced search  

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

Pages: 1 2 [3] 4   Go Down

Author Topic: add 'previous' and 'next' to page tabs.  (Read 81178 times)

0 Members and 2 Guests are viewing this topic.

Tranz

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Female
  • Posts: 6149
Re: add 'previous' and 'next' to page tabs.
« Reply #40 on: February 11, 2006, 07:43:05 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:
Code: [Select]
        $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

Code: [Select]
        $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.
Logged

CypherBit

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 30
Re: add 'previous' and 'next' to page tabs.
« Reply #41 on: February 11, 2006, 10:18:38 pm »

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

Tranz

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Female
  • Posts: 6149
Re: add 'previous' and 'next' to page tabs.
« Reply #42 on: February 11, 2006, 10:35:29 pm »

Glad to be of service. :)
Logged

Gephri

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 235
Re: add 'previous' and 'next' to page tabs.
« Reply #43 on: February 17, 2006, 06:02:26 pm »

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.
Logged

THoTH_2005

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 23
  • Be Cool
    • The Book Of THoTH
Re: add 'previous' and 'next' to page tabs.
« Reply #44 on: February 23, 2006, 05:44:04 pm »

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"
Logged
All wisdom is contained in The Book Of THoTH

nicedreams

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: add 'previous' and 'next' to page tabs.
« Reply #45 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
Logged

THoTH_2005

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 23
  • Be Cool
    • The Book Of THoTH
Re: add 'previous' and 'next' to page tabs.
« Reply #46 on: March 05, 2006, 11:34:39 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?
Logged
All wisdom is contained in The Book Of THoTH

lordprodigy

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 228
    • B514 ///
Re: add 'previous' and 'next' to page tabs.
« Reply #47 on: March 10, 2006, 10:27:50 pm »

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.

Logged

akulion

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 21
Re: add 'previous' and 'next' to page tabs.
« Reply #48 on: October 24, 2006, 06:53:50 am »

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

Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: add 'previous' and 'next' to page tabs.
« Reply #49 on: October 24, 2006, 07:38:14 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.
Logged

akulion

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 21
Re: add 'previous' and 'next' to page tabs.
« Reply #50 on: October 24, 2006, 03:30:41 pm »

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
Logged

Hein Traag

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: nl
  • Offline Offline
  • Gender: Male
  • Posts: 2166
  • A, B, Cpg
    • Personal website - Spintires.nl
Re: add 'previous' and 'next' to page tabs.
« Reply #51 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
Logged

Gephri

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 235
Re: add 'previous' and 'next' to page tabs.
« Reply #52 on: December 11, 2006, 05:27:26 am »

I also have this same problem
Quote
edited 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
Logged

Air_Cooled_Nut

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Re: add 'previous' and 'next' to page tabs.
« Reply #53 on: March 25, 2007, 08:20:40 pm »

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 :)
Logged

mireille

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: add 'previous' and 'next' to page tabs.
« Reply #54 on: August 21, 2007, 01:35:34 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

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
Code: [Select]
// 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."

Code: [Select]
// 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",
);
Logged

mireille

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Re: add 'previous' and 'next' to page tabs.
« Reply #55 on: August 21, 2007, 03:01:54 pm »

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]
Logged

Stramm

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: 00
  • Offline Offline
  • Gender: Male
  • Posts: 6006
    • Bettis Wollwelt
Re: add 'previous' and 'next' to page tabs.
« Reply #56 on: August 21, 2007, 03:22:03 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
Quote
Maximum 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

  • Contributor
  • Coppermine novice
  • ***
  • Offline Offline
  • Posts: 34
Re: 1.3, add 'previous' and 'next' to page tabs.
« Reply #57 on: November 21, 2007, 05:25:21 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

Code: [Select]
    $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

Code: [Select]
    $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
Logged

Darren_S

  • Coppermine newbie
  • Offline Offline
  • Posts: 1
Re: add 'previous' and 'next' to page tabs.
« Reply #58 on: May 31, 2008, 10:57:40 pm »

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:

Code: [Select]
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:

Code: [Select]
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!
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: add 'previous' and 'next' to page tabs.
« Reply #59 on: June 01, 2008, 10:19:13 am »

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!
Logged
Pages: 1 2 [3] 4   Go Up
 

Page created in 0.041 seconds with 21 queries.