forum.coppermine-gallery.net

No Support => Modifications/Add-Ons/Hacks => Mods: Miscellaneous => Topic started by: yoshikiwei on July 22, 2004, 07:26:15 am

Title: add 'previous' and 'next' to page tabs.
Post by: yoshikiwei 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
Title: Re: simple next page hack
Post by: Joachim Müller on July 22, 2004, 09:47:34 am
please post your hack  :D

GauGau
Title: Re: simple next page hack
Post by: yoshikiwei 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**********************
Title: Re: 1.3, add 'previous' and 'next' to page tabs.
Post by: Incite on July 23, 2004, 03:34:05 am
I like the idea, do you have a working example?
Title: Re: 1.3, add 'previous' and 'next' to page tabs.
Post by: yoshikiwei on July 23, 2004, 05:25:45 am
sorry I don't have a live site

heres some screenshot
(https://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Fimg46.exs.cx%2Fimg46%2F7370%2Fexample1.jpg&hash=3fda31849be66e6aa1fe5d1bd92691c79fcb4a96)
(https://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Fimg46.exs.cx%2Fimg46%2F7941%2Fexample2.jpg&hash=683a74e4d11d2bc42ef328580fa3dc213acf179a)
Title: Re: 1.3, add 'previous' and 'next' to page tabs.
Post by: avileta on July 26, 2004, 02:11:09 am
Works perfectly.  Thank you!

Andy
Title: Re: 1.3, add 'previous' and 'next' to page tabs.
Post by: raummusik 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
Title: Re: 1.3, add 'previous' and 'next' to page tabs.
Post by: Joachim Müller 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
Title: Re: 1.3, add 'previous' and 'next' to page tabs.
Post by: 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
Title: Re: 1.3, add 'previous' and 'next' to page tabs.
Post by: yoshikiwei 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
Title: Re: 1.3, add 'previous' and 'next' to page tabs.
Post by: rosyvin 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.

Title: Re: 1.3, add 'previous' and 'next' to page tabs.
Post by: Joachim Müller 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
Title: Re: 1.3, add 'previous' and 'next' to page tabs.
Post by: michael singer on November 01, 2004, 03:51:25 pm
this works very nicely!

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

 thank you!
Title: Re: 1.3, add 'previous' and 'next' to page tabs.
Post by: WhiteMew on November 27, 2004, 04:01:34 am
This is exactly what I was looking for, thanks a lot ^___^
Title: Re: 1.3, add 'previous' and 'next' to page tabs.
Post by: Hein Traag 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 ?
Title: Re: 1.3, add 'previous' and 'next' to page tabs.
Post by: Alejandrito on December 19, 2004, 10:26:35 am
it works ok, this is another mod that should be in the next release ;)
saludos
Title: Re: 1.3, add 'previous' and 'next' to page tabs.
Post by: Joachim Müller 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
Title: Re: 1.3, add 'previous' and 'next' to page tabs.
Post by: jriba on December 20, 2004, 07:51:24 pm
Great mod! Thanks!
Title: Re: add 'previous' and 'next' to page tabs.
Post by: Sonikempire 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?????????
Title: Re: add 'previous' and 'next' to page tabs.
Post by: Joachim Müller on May 09, 2005, 07:02:33 am
ignore notices (or switch them off) if they don't mean anything to you.
Title: Re: add 'previous' and 'next' to page tabs.
Post by: Hein Traag on May 11, 2005, 05:38:27 pm
Has someone managed to put the next and forward above the thumbnails yet ? Or is that something which can't be done nicely ?
Title: Re: add 'previous' and 'next' to page tabs.
Post by: steverobbins on May 11, 2005, 06:48:08 pm
It works a treat!  Thanks for this mod, I've been thinking about how to make this work for a while.

Live example at http://www.steverobbins.co.uk/gallery/thumbnails.php?album=2&page=23

Cheers,
Steve.
Title: Re: add 'previous' and 'next' to page tabs.
Post by: xpurtwitness on July 11, 2005, 11:37:32 pm
yikes!  i just made the changes, and i'm getting major errors.  http://stedfast.net/gallery

any thoughts?
Title: Re: add 'previous' and 'next' to page tabs.
Post by: modtang on July 12, 2005, 12:26:27 am
Thanks for this hack. I wanted to add something like this and it was so simple to do. Much appreciated.  ;D

As for those errors, I'm gonna take a stab at it and say you're only replacing the one line in functions and not the WHOLE function.

Quote
in functions.inc.php, find the function
Code: [Select]
function create_tabs($items, $curr_page, $total_pages, $template)replace the WHOLE function with...

The whole function starts at the above code and ends at
Code: [Select]
        return $tabs.$template['tab_trailer'];
}
Title: Re: add 'previous' and 'next' to page tabs.
Post by: xpurtwitness on July 12, 2005, 05:28:20 am
wonderful!  i thought it was weird that there wasn't an ending described.  so it seems to work.  however, i don't see the current page number highlighted...  well it seems it is technically a different color, but i think i need a bigger contrast.  what element will i need to change the assigned color for?
Title: Re: add 'previous' and 'next' to page tabs.
Post by: xpurtwitness on July 12, 2005, 02:41:48 pm
well i think i have it...the tableb_compact class.  however, it also influences the descriptions on the main page...
Title: Re: add 'previous' and 'next' to page tabs.
Post by: modtang on July 18, 2005, 03:02:53 pm
How does it influence the description? I didn't notice any change with my gallery. You were right though. Under

Code: [Select]
.tableb_compact
change

Code: [Select]
background: #515b67;
to whatever you want it to be.

Working example: http://carminegiovinazzo.net/gallery/

Has someone managed to put the next and forward above the thumbnails yet ? Or is that something which can't be done nicely ?

Isn't this what the filmstrip does?
Title: Re: add 'previous' and 'next' to page tabs.
Post by: pious on August 17, 2005, 04:22:04 pm
I must have done something wrong.  I was successful at adding the PREV/NEXT to my page, but now I've lost the numbers.  What did I do wrong?  Or, better yet, how can I get the numbers back and still have the PREV/NEXT on each page?

Please advise.   :-\\
Title: Re: add 'previous' and 'next' to page tabs.
Post by: snork13 on August 17, 2005, 04:44:33 pm
I must have done something wrong.  I was successful at adding the PREV/NEXT to my page, but now I've lost the numbers.  What did I do wrong?  Or, better yet, how can I get the numbers back and still have the PREV/NEXT on each page?

Please advise.   :-\\

i would try it again from your backup file, if you don't get that time, post what you've done so far.

-snork

below is the theme.php part, should help!

Code: [Select]
    $theme_thumb_tab_tmpl = $template_tab_display;

    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'));
        $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'));
    } 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'));
        $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'));
    }
Title: Re: add 'previous' and 'next' to page tabs.
Post by: PKfanSteph on August 18, 2005, 08:34:56 am
I made the changes and am getting the error:

Quote
Parse error: parse error, unexpected T_STRING in /usr/local/psa/home/vhosts/playthrume.com/httpdocs/photos/include/functions.inc.php on line 202

Any ideas?  I'm using a modified version of the Digital Red theme.
Title: Re: add 'previous' and 'next' to page tabs.
Post by: yoshikiwei on August 18, 2005, 10:57:15 am
I must have done something wrong.  I was successful at adding the PREV/NEXT to my page, but now I've lost the numbers.  What did I do wrong?  Or, better yet, how can I get the numbers back and still have the PREV/NEXT on each page?

Please advise.   :-\\

Yes I would recommend that you do a backup from the old files and try the mod all over again.
Title: Re: add 'previous' and 'next' to page tabs.
Post by: yoshikiwei on August 18, 2005, 10:58:04 am
I made the changes and am getting the error:

Quote
Parse error: parse error, unexpected T_STRING in /usr/local/psa/home/vhosts/playthrume.com/httpdocs/photos/include/functions.inc.php on line 202

Any ideas?  I'm using a modified version of the Digital Red theme.

What's on line 202 of your functions.inc.php ?
Title: Re: add 'previous' and 'next' to page tabs.
Post by: xplicit on September 16, 2005, 10:12:49 pm
Anybody did this for the userlist aswell?

I'll try myself and post the code here if I succeed   :D
Title: Re: add 'previous' and 'next' to page tabs.
Post by: xplicit on September 17, 2005, 12:54:21 am
Ok well shame on me for asking it was too easy.....

find in usermgr.php:

Code: [Select]
$tab_tmpl = array('left_text' => '<td width="100%%" align="left" valign="middle" class="tableh1_compact" style="white-space: nowrap"><b>' . $lang_usermgr_php['u_user_on_p_pages'] . '</b></td>' . "\n",
        'tab_header' => '',
        'tab_trailer' => '',
        'active_tab' => '<td><img src="images/spacer.gif" width="1" height="1"></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"></td>' . "\n" . '<td align="center" valign="middle" class="navmenu"><a href="' . $PHP_SELF . '?page=%d&sort=' . $sort . '"<b>%d</b></a></td>' . "\n"
        );

replace by:

Code: [Select]
$tab_tmpl = array('left_text' => '<td width="100%%" align="left" valign="middle" class="tableh1_compact" style="white-space: nowrap"><b>' . $lang_usermgr_php['u_user_on_p_pages'] . '</b></td>' . "\n",
'tab_header' => '',
'tab_trailer' => '',
'active_tab' => '<td><img src="images/spacer.gif" width="1" height="1"></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"></td>' . "\n" . '<td align="center" valign="middle" class="navmenu"><a href="' . $PHP_SELF . '?page=%d&sort=' . $sort . '"<b>%d</b></a></td>' . "\n",
'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="' . $PHP_SELF . '?page=%d&sort=' . $sort . '"<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="' . $PHP_SELF . '?page=%d&sort=' . $sort . '"<b>%s</b></a></td>',
);
Title: Re: add 'previous' and 'next' to page tabs.
Post by: PKfanSteph on September 23, 2005, 11:57:08 pm

Has someone managed to put the next and forward above the thumbnails yet ? Or is that something which can't be done nicely ?

Isn't this what the filmstrip does?


I like this next/previous part, but my biggest problem is users who just look at the thumbnails page and don't go to the full size image until they see something they like.  My image views count always decreases after the initial page of thumbnails.   Adding the filmstrip doesn't help in this case.  I still would prefer the numbers AND the next / previous links both above and below the thumbnails.  Picky, aren't I?  ;).  Just a personal preference, I suppose.
Title: Re: add 'previous' and 'next' to page tabs.
Post by: sion3000 on September 26, 2005, 10:43:13 pm
EDIT: Sorry just managed to fix this. I didnt edit enough of the code in the functions.inc.php finaly got it working. Great hack.
If anyone gets notices when they are not in debug mode for this hack check that the last thing after the final bit of code it /** or something simelar.
Keep up good work everyone.!!!


Hello

I have added the new previous and next into my code. But i am now getting notices appear. My seeting for "Show notices in debug" is shwitched off + im not even running in debug mode. Is there any way of turning off these notices off in normal mode ?

My lines ive got problems with:

Notice: Undefined index: max_tabs in /files/home2/sion3000/include/functions.inc.php on line 267
Notice: Undefined variable: template in /files/home2/sion3000/include/functions.inc.php on line 269
Notice: Undefined variable: items in /files/home2/sion3000/include/functions.inc.php on line 269
Notice: Undefined variable: total_pages in /files/home2/sion3000/include/functions.inc.php on line 269
Notice: Undefined variable: total_pages in /files/home2/sion3000/include/functions.inc.php on line 270
Notice: Undefined variable: template in /files/home2/sion3000/include/functions.inc.php on line 272
Notice: Undefined variable: curr_page in /files/home2/sion3000/include/functions.inc.php on line 273
Notice: Undefined variable: template in /files/home2/sion3000/include/functions.inc.php on line 276
Notice: Undefined variable: total_pages in /files/home2/sion3000/include/functions.inc.php on line 278
Notice: Undefined variable: total_pages in /files/home2/sion3000/include/functions.inc.php on line 284
Notice: Undefined variable: total_pages in /files/home2/sion3000/include/functions.inc.php on line 293
Notice: Undefined variable: template in /files/home2/sion3000/include/functions.inc.php on line 300

Any sugestions anyone ?

I have a while back upgraded from 1.2 --> 1.33 without any problems + have the pay pal shop hack in my theme.

Thanks

Sion

Oh my site is www.coolshots.co.uk

thanks
Title: Re: add 'previous' and 'next' to page tabs.
Post by: Joachim Müller on September 27, 2005, 07:41:52 am
turn off notices if they don't mean anything to you.
Title: Re: add 'previous' and 'next' to page tabs.
Post by: COS@RIN on November 06, 2005, 03:56:32 am
For all you 1.4x people.

This seems to work fantastically in the beta version now.

One of the Dev Team must have sorted it, however all the code posted by Yoshikiwei is allready in the file codes except the first alteration in themes.php. The only thing to remember is that if you have used the classic template as your base then the thems.php file is in the includes folder and called themes.inc.php

Thanks DEV team for a fantastic gallery.


COSARIN
Title: Re: add 'previous' and 'next' to page tabs.
Post by: 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.
Title: Re: add 'previous' and 'next' to page tabs.
Post by: CypherBit on February 11, 2006, 07:33:15 pm
Great mod, thank you.

But I have a problem validating it: http://www.cypherbit.com/coppermine/ (http://www.cypherbit.com/coppermine/) I get two errors: http://validator.w3.org/check?uri=http://www.cypherbit.com/coppermine/ (http://validator.w3.org/check?uri=http://www.cypherbit.com/coppermine/) anyone able to fix this?
Title: Re: add 'previous' and 'next' to page tabs.
Post by: Tranz on February 11, 2006, 07:43:05 pm
But I have a problem validating it: http://www.cypherbit.com/coppermine/ (http://www.cypherbit.com/coppermine/) I get two errors: http://validator.w3.org/check?uri=http://www.cypherbit.com/coppermine/ (http://validator.w3.org/check?uri=http://www.cypherbit.com/coppermine/) anyone able to fix this?

You need to change & to &amp; 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 . '&amp;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 . '&amp;page=%d'));

I'm just guessing... I don't use the mod so I haven't tested.
Title: Re: add 'previous' and 'next' to page tabs.
Post by: CypherBit on February 11, 2006, 10:18:38 pm
Good "guesswork".
I replaced all instances of & with &amp; and it validates just fine. Thank you TranzNDance.
Title: Re: add 'previous' and 'next' to page tabs.
Post by: Tranz on February 11, 2006, 10:35:29 pm
Glad to be of service. :)
Title: Re: add 'previous' and 'next' to page tabs.
Post by: Gephri 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.
Title: Re: add 'previous' and 'next' to page tabs.
Post by: THoTH_2005 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"
Title: Re: add 'previous' and 'next' to page tabs.
Post by: 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
Title: Re: add 'previous' and 'next' to page tabs.
Post by: THoTH_2005 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?
Title: Re: add 'previous' and 'next' to page tabs.
Post by: lordprodigy 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.

Title: Re: add 'previous' and 'next' to page tabs.
Post by: akulion 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

Title: Re: add 'previous' and 'next' to page tabs.
Post by: Joachim Müller 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.
Title: Re: add 'previous' and 'next' to page tabs.
Post by: akulion 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
Title: Re: add 'previous' and 'next' to page tabs.
Post by: Hein Traag 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
Title: Re: add 'previous' and 'next' to page tabs.
Post by: Gephri 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
Title: Re: add 'previous' and 'next' to page tabs.
Post by: Air_Cooled_Nut 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 :)
Title: Re: add 'previous' and 'next' to page tabs.
Post by: mireille 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",
);
Title: Re: add 'previous' and 'next' to page tabs.
Post by: mireille 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]
Title: Re: add 'previous' and 'next' to page tabs.
Post by: Stramm 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.
Title: Re: 1.3, add 'previous' and 'next' to page tabs.
Post by: jesusarmy 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
Title: Re: add 'previous' and 'next' to page tabs.
Post by: Darren_S 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!
Title: Re: add 'previous' and 'next' to page tabs.
Post by: Joachim Müller 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!
Title: Re: add 'previous' and 'next' to page tabs.
Post by: net on August 25, 2008, 09:56:39 am
Anyone who has successfully added this hack to theme "chaoticsoul" http://forum.coppermine-gallery.net/index.php/topic,39753.0.html (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.
Title: Re: add 'previous' and 'next' to page tabs.
Post by: Gizmo on August 28, 2008, 03:47:32 am
@net

solution given in your other post here (http://forum.coppermine-gallery.net/index.php/topic,54743.msg266825.html#msg266825).
Title: Re: add 'previous' and 'next' to page tabs.
Post by: Oli_Pavitt on September 02, 2008, 11:22:14 am
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
Title: Re: add 'previous' and 'next' to page tabs.
Post by: Paver on December 15, 2008, 11:10:03 am
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.
Title: Re: add 'previous' and 'next' to page tabs.
Post by: Ludo on February 09, 2009, 03:52:45 pm
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:
Code: [Select]
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.