Advanced search  

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Pages: [1]   Go Down

Author Topic: Add To Lightbox On Image Navigation Bar  (Read 5220 times)

0 Members and 1 Guest are viewing this topic.

pressurecooker

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 35
    • Environmental Articles
Add To Lightbox On Image Navigation Bar
« on: May 05, 2008, 05:18:49 pm »

Hi,

I am trying to add the "Lightbox" button to the Image navigation bar (near the Thumbnails icon).
The problem is that Lightbox button is defined in Themes.php while the Img navigation bar is in the Themes.Inc.php. My Lightbox is separate from the File information, I made a new template variable called {FAVES}. First I tried to add {FAVES} to the part of Themes.inc which deals with navigation bar. It doesn't work. Then I tried to remove Navigation Bar part from Themes.inc and add it to Themes.php. That didn't work either.

I would be grateful for any suggestions.

Url is: www.nanotoxic.com/cpg.html
The idea what I want to achieve is attached
Logged
Join the green campaign - Environmental Articles

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Add To Lightbox On Image Navigation Bar
« Reply #1 on: May 05, 2008, 07:43:36 pm »

The problem is that Lightbox button is defined in Themes.php while the Img navigation bar is in the Themes.Inc.php.
No, that is wrong. include/themes.inc.php is just the core default file that never should be changed or edited. You can override anything you want to see overridden in themes/yourtheme/theme.php.
Undo your changes in include/themes.inc.php and apply your changes to themes/yourtheme/theme.php. If you can find the section you want to modify in your custom theme, copy the "missing" section from themes/sample/theme.php
Logged

pressurecooker

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 35
    • Environmental Articles
Re: Add To Lightbox On Image Navigation Bar
« Reply #2 on: May 06, 2008, 10:26:04 am »

Ok, so you mean that if I add $template_img_navbar plus all its $params to Theme.php the same part of Theme.Inc.php will be just ignored?  :o
That's interesting. I will try, thanks.
Logged
Join the green campaign - Environmental Articles

pressurecooker

  • Coppermine novice
  • *
  • Offline Offline
  • Gender: Male
  • Posts: 35
    • Environmental Articles
Re: Add To Lightbox On Image Navigation Bar
« Reply #3 on: May 06, 2008, 11:06:51 am »

 ;D Great! Thank you GauGau, you're a genius!

Now, here's what I did:

1. Copy $template_img_navbar from sample template.php to my own template.php

2. Copy the whole function theme_html_img_nav_menu() from sample template.php to my template.php

3. The first lines of theme_html_img_nav_menu() was:
Code: [Select]
function theme_html_img_nav_menu()
{
    global $CONFIG, $CURRENT_PIC_DATA, $meta_nav, $THEME_DIR ; //$PHP_SELF,
    global $album, $cat, $pos, $pic_count, $lang_img_nav_bar, $lang_text_dir, $template_img_navbar;
Changed to:
Code: [Select]
function theme_html_img_nav_menu()
{
    global $CONFIG, $CURRENT_PIC_DATA, $FAVPICS, $meta_nav, $THEME_DIR ; //$PHP_SELF,
    global $album, $cat, $pos, $pic_count, $lang_display_image_php, $lang_picinfo, $lang_img_nav_bar, $lang_text_dir, $template_img_navbar;

4. Anywhere in the same function but before $params, entered this stuff:
Code: [Select]
if (!in_array($CURRENT_PIC_DATA['pid'], $FAVPICS)) {
        $myFave2[$lang_picinfo['addFavPhrase']] = "<a href=\"addfav.php?pid=" . $CURRENT_PIC_DATA['pid'] . $ref . "\" >" . $lang_picinfo['addFav'] . '</a>';
    } else {
        $myFave2[$lang_picinfo['addFavPhrase']] = "<a href=\"addfav.php?pid=" . $CURRENT_PIC_DATA['pid']  . $ref . "\" >" . $lang_picinfo['remFav'] . '</a>';
    }

5. In the $params list added this:
Code: [Select]
'{FAVES2}' => $myFave2[$lang_picinfo['addFavPhrase']],
6. In the template variable $template_img_navbar mix {FAVES2} within the html code where I want it to appear.

Eeh, it's gorgeous. I'm starting to love this...
Logged
Join the green campaign - Environmental Articles

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Add To Lightbox On Image Navigation Bar
« Reply #4 on: May 06, 2008, 06:29:18 pm »

Ok, so you mean that if I add $template_img_navbar plus all its $params to Theme.php the same part of Theme.Inc.php will be just ignored?  :o
Exactly: stuff in theme.php overrides stuff in themes.inc.php

1. Copy $template_img_navbar from sample template.php to my own template.php
It's actually theme.php, not template.php - just posting this as a clarification for others.
Logged
Pages: [1]   Go Up
 

Page created in 0.02 seconds with 19 queries.