Advanced search  

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]

Pages: [1] 2 3 4   Go Down

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

0 Members and 1 Guest are viewing this topic.

yoshikiwei

  • Contributor
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Posts: 68
add 'previous' and 'next' to page tabs.
« on: July 22, 2004, 07:26:15 am »

had anyone done mods to the pages "tabs" in thumbnails to show a "Prev page" and "Next page" ?

I had made a smalll hack on that

anyone interested i will post it here

thannks
« Last Edit: January 30, 2006, 07:49:35 am by GauGau »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: simple next page hack
« Reply #1 on: July 22, 2004, 09:47:34 am »

please post your hack  :D

GauGau
Logged

yoshikiwei

  • Contributor
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Posts: 68
Re: simple next page hack
« Reply #2 on: July 22, 2004, 10:11:18 am »

Just 2 files to change, yourtheme.php and include/functions.inc.php

in yourtheme.php, look for
Code: [Select]
$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' => '',
add after
Code: [Select]
'active_next_tab' => '<td><img src="images/spacer.gif" width="1" height="1"></td>' . "\n" . '<td align="center" valign="middle" class="tableb_compact"><b>%s</b></td>',
'inactive_next_tab' => '<td><img src="images/spacer.gif" width="1" height="1"></td>' . "\n" . '<td align="center" valign="middle" class="navmenu"><a href="{LINK}"<b>%s</b></a></td>',
'active_prev_tab' => '<td><img src="images/spacer.gif" width="1" height="1"></td>' . "\n" . '<td align="center" valign="middle" class="tableb_compact"><b>%s</b></td>',
'inactive_prev_tab' => '<td><img src="images/spacer.gif" width="1" height="1"></td>' . "\n" . '<td align="center" valign="middle" class="navmenu"><a href="{LINK}"<b>%s</b></a></td>',
find
Code: [Select]
$theme_alb_list_tab_tmpl['inactive_tab'] = strtr($theme_alb_list_tab_tmpl['inactive_tab'], array('{LINK}' => 'index.php?cat=' . $cat . '&page=%d'));add after
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 . '&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 . '&page=%d'));

find
Code: [Select]
   if ($mode == 'thumb') {
        $theme_thumb_tab_tmpl['left_text'] = strtr($theme_thumb_tab_tmpl['left_text'], array('{LEFT_TEXT}' => $lang_thumb_view['pic_on_page']));
        $theme_thumb_tab_tmpl['inactive_tab'] = strtr($theme_thumb_tab_tmpl['inactive_tab'], array('{LINK}' => 'thumbnails.php?album=' . $aid . $cat_link . '&page=%d'));
add after
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'));

find
Code: [Select]
   } else {
        $theme_thumb_tab_tmpl['left_text'] = strtr($theme_thumb_tab_tmpl['left_text'], array('{LEFT_TEXT}' => $lang_thumb_view['user_on_page']));
        $theme_thumb_tab_tmpl['inactive_tab'] = strtr($theme_thumb_tab_tmpl['inactive_tab'], array('{LINK}' => 'index.php?cat=' . $cat . '&page=%d'));
add after
Code: [Select]
       $theme_thumb_tab_tmpl['inactive_next_tab'] = strtr($theme_thumb_tab_tmpl['inactive_next_tab'], array('{LINK}' => 'index.php?cat=' . $cat . '&page=%d'));
        $theme_thumb_tab_tmpl['inactive_prev_tab'] = strtr($theme_thumb_tab_tmpl['inactive_prev_tab'], array('{LINK}' => 'index.php?cat=' . $cat . '&page=%d'));

in functions.inc.php, find the function
Code: [Select]
function create_tabs($items, $curr_page, $total_pages, $template)replace the WHOLE function 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'];
}

I am using the theme water_drop
a [Prev] and [Next] button tab will appear in all thumbnails page

apologise for the poor expressing of my hack

***********Updated a piece of forgotten code**********************
« Last Edit: July 22, 2004, 03:22:02 pm by yoshikiwei »
Logged

Incite

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 23
Re: 1.3, add 'previous' and 'next' to page tabs.
« Reply #3 on: July 23, 2004, 03:34:05 am »

I like the idea, do you have a working example?
Logged

yoshikiwei

  • Contributor
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Posts: 68
Re: 1.3, add 'previous' and 'next' to page tabs.
« Reply #4 on: July 23, 2004, 05:25:45 am »

sorry I don't have a live site

heres some screenshot
(http://img46.exs.cx/img46/7370/example1.jpg)
(http://img46.exs.cx/img46/7941/example2.jpg)
Logged

avileta

  • Coppermine newbie
  • Offline Offline
  • Gender: Male
  • Posts: 17
    • Old Bones
Re: 1.3, add 'previous' and 'next' to page tabs.
« Reply #5 on: July 26, 2004, 02:11:09 am »

Works perfectly.  Thank you!

Andy
Logged
Andy

raummusik

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 30
Re: 1.3, add 'previous' and 'next' to page tabs.
« Reply #6 on: July 27, 2004, 11:03:23 pm »

yeah . yihhaa. works also perfect for me. yiiha. thx man ! ;) . now i need to know how to change the number links , the style. so i can see "where" i am , by changing the color of the active link . i saw at those screenshots that it's at your theme. or css.. can you tell me where you changed this ?

mfg
raum
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: 1.3, add 'previous' and 'next' to page tabs.
« Reply #7 on: July 28, 2004, 08:48:44 am »

you already asked this on another thread. Please don't try to hijack this thread, it's dedicated to the mod ('previous' and 'next' page tabs).

GauGau
Logged

rosyvin

  • Guest
Re: 1.3, add 'previous' and 'next' to page tabs.
« Reply #8 on: July 29, 2004, 05:48:23 pm »

Hi, this is a great idea,
but I've got a question: it could works for the version 1.2 too ?
thanks
Logged

yoshikiwei

  • Contributor
  • Coppermine regular visitor
  • ***
  • Offline Offline
  • Posts: 68
Re: 1.3, add 'previous' and 'next' to page tabs.
« Reply #9 on: July 29, 2004, 05:56:23 pm »

Hi, this is a great idea,
but I've got a question: it could works for the version 1.2 too ?
thanks

it really should, theres not much changes to the codes for this hack
maybe the dev team can double confirm
Logged

rosyvin

  • Guest
Re: 1.3, add 'previous' and 'next' to page tabs.
« Reply #10 on: July 29, 2004, 06:37:51 pm »

it really should, theres not much changes to the codes for this hack
maybe the dev team can double confirm

thanks, I'm going to try this.

Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: 1.3, add 'previous' and 'next' to page tabs.
« Reply #11 on: July 30, 2004, 09:38:05 am »

it really should, theres not much changes to the codes for this hack
maybe the dev team can double confirm
urm, not really: in fact, support for older versions can only be given rudimentary. None of us is running a cpg1.2.1 install any more, and we won't/can't test mods. Actually, we're quite busy developing new versions and doing support on this board, we simply can't afford to test everything out, since this can be done by users as well. We have to rely on user feedback in this case.

GauGau
Logged

michael singer

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 42
  • random image from: www.a-visual-notebook.at
    • a visual notebook
Re: 1.3, add 'previous' and 'next' to page tabs.
« Reply #12 on: November 01, 2004, 03:51:25 pm »

this works very nicely!

(the only thing i had to adjust, was the style).

 thank you!
Logged

WhiteMew

  • Coppermine newbie
  • Offline Offline
  • Gender: Female
  • Posts: 4
Re: 1.3, add 'previous' and 'next' to page tabs.
« Reply #13 on: November 27, 2004, 04:01:34 am »

This is exactly what I was looking for, thanks a lot ^___^
Logged

Hein Traag

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: nl
  • Offline Offline
  • Gender: Male
  • Posts: 2166
  • A, B, Cpg
    • Personal website - Spintires.nl
Re: 1.3, add 'previous' and 'next' to page tabs.
« Reply #14 on: December 06, 2004, 06:33:41 pm »

Installed at pictures.scoutlink.net, works just fine!

Searching but can't find the correct place to add PREV and NEXT in the row above the thumbnails.
Any hints or pointers as to where i might look in the code for accomplishing this ?
Logged

Alejandrito

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 31
Re: 1.3, add 'previous' and 'next' to page tabs.
« Reply #15 on: December 19, 2004, 10:26:35 am »

it works ok, this is another mod that should be in the next release ;)
saludos
Logged

Joachim Müller

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

jriba

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 21
Re: 1.3, add 'previous' and 'next' to page tabs.
« Reply #17 on: December 20, 2004, 07:51:24 pm »

Great mod! Thanks!
Logged

Sonikempire

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
    • SonikEmpire
Re: add 'previous' and 'next' to page tabs.
« Reply #18 on: May 09, 2005, 06:52:05 am »

Code: [Select]
Notice: Undefined index: max_tabs in /home/sonikemp/public_html/gallery/include/functions.inc.php on line 271

Notice: Undefined variable: template in /home/sonikemp/public_html/gallery/include/functions.inc.php on line 273

Notice: Undefined variable: items in /home/sonikemp/public_html/gallery/include/functions.inc.php on line 273

Notice: Undefined variable: total_pages in /home/sonikemp/public_html/gallery/include/functions.inc.php on line 273

Notice: Undefined variable: total_pages in /home/sonikemp/public_html/gallery/include/functions.inc.php on line 274

Notice: Undefined variable: template in /home/sonikemp/public_html/gallery/include/functions.inc.php on line 276

Notice: Undefined variable: curr_page in /home/sonikemp/public_html/gallery/include/functions.inc.php on line 277

Notice: Undefined variable: template in /home/sonikemp/public_html/gallery/include/functions.inc.php on line 280

Notice: Undefined variable: total_pages in /home/sonikemp/public_html/gallery/include/functions.inc.php on line 282

Notice: Undefined variable: total_pages in /home/sonikemp/public_html/gallery/include/functions.inc.php on line 288

Notice: Undefined variable: total_pages in /home/sonikemp/public_html/gallery/include/functions.inc.php on line 297

Notice: Undefined variable: template in /home/sonikemp/public_html/gallery/include/functions.inc.php on line 304

What is going on?????????
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 #19 on: May 09, 2005, 07:02:33 am »

ignore notices (or switch them off) if they don't mean anything to you.
Logged
Pages: [1] 2 3 4   Go Up
 

Page created in 0.024 seconds with 20 queries.