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

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

yoshikiwei

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

Joachim Müller

please post your hack  :D

GauGau

yoshikiwei

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

in yourtheme.php, look for
$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
'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
$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
   $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
   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
       $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
   } 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
       $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
function create_tabs($items, $curr_page, $total_pages, $template)
replace the WHOLE function 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'];
}


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**********************

Incite

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

yoshikiwei

sorry I don't have a live site

heres some screenshot
(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fimg46.exs.cx%2Fimg46%2F7370%2Fexample1.jpg&hash=3fda31849be66e6aa1fe5d1bd92691c79fcb4a96)
(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fimg46.exs.cx%2Fimg46%2F7941%2Fexample2.jpg&hash=683a74e4d11d2bc42ef328580fa3dc213acf179a)

avileta

Andy

raummusik

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

Joachim Müller

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

rosyvin

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

yoshikiwei

Quote from: rosyvin 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

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

rosyvin

Quote from: yoshikiwei on July 29, 2004, 05:56:23 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.


Joachim Müller

Quote from: yoshikiwei on July 29, 2004, 05:56:23 PM
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

michael singer

this works very nicely!

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

thank you!

WhiteMew

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

Hein Traag

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 ?

Alejandrito

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

Joachim Müller

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

jriba


Sonikempire

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?????????

Joachim Müller

ignore notices (or switch them off) if they don't mean anything to you.