forum.coppermine-gallery.net
No Support => Modifications/Add-Ons/Hacks => Mods: Miscellaneous => Topic started 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
-
please post your hack :D
GauGau
-
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**********************
-
I like the idea, do you have a working example?
-
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)
-
Works perfectly. Thank you!
Andy
-
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
-
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
-
Hi, this is a great idea,
but I've got a question: it could works for the version 1.2 too ?
thanks
-
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
-
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.
-
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
-
this works very nicely!
(the only thing i had to adjust, was the style).
thank you!
-
This is exactly what I was looking for, thanks a lot ^___^
-
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 ?
-
it works ok, this is another mod that should be in the next release ;)
saludos
-
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
-
Great mod! Thanks!
-
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?????????
-
ignore notices (or switch them off) if they don't mean anything to you.
-
Has someone managed to put the next and forward above the thumbnails yet ? Or is that something which can't be done nicely ?
-
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.
-
yikes! i just made the changes, and i'm getting major errors. http://stedfast.net/gallery
any thoughts?
-
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.
in functions.inc.php, find the function
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
return $tabs.$template['tab_trailer'];
}
-
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?
-
well i think i have it...the tableb_compact class. however, it also influences the descriptions on the main page...
-
How does it influence the description? I didn't notice any change with my gallery. You were right though. Under
.tableb_compact
change
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?
-
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 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!
$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'));
}
-
I made the changes and am getting the error:
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.
-
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.
-
I made the changes and am getting the error:
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 ?
-
Anybody did this for the userlist aswell?
I'll try myself and post the code here if I succeed :D
-
Ok well shame on me for asking it was too easy.....
find in usermgr.php:
$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:
$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>',
);
-
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.
-
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
-
turn off notices if they don't mean anything to you.
-
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
-
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.
-
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?
-
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 & 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.
-
Good "guesswork".
I replaced all instances of & with & and it validates just fine. Thank you TranzNDance.
-
Glad to be of service. :)
-
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.
-
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"
-
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
-
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?
-
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.
-
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
-
Will this work with 1.4.9 ?
Why don't you try it and tell us? It should work, but hasn't been tested.
-
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
-
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
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
-
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 :)
-
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
// 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",
);
-
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]
-
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
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.
-
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 . '&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 . '&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'));
and then do the same again in the function theme_display_album_list_cat
-
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!
-
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!
-
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.
-
@net
solution given in your other post here (http://forum.coppermine-gallery.net/index.php/topic,54743.msg266825.html#msg266825).
-
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
-
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.
-
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:
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.