Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Add pic title to breadcrumb  (Read 6795 times)

0 Members and 1 Guest are viewing this topic.

mdssdm

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Add pic title to breadcrumb
« on: May 25, 2006, 05:09:06 pm »

Hi,

I'm trying to make my gallery use less space.
To do so, I want to add the pic title to the breadcrumb, so that pic title and
navigation (breadcrumb) is in one row.

see attachment for details

The search came up with this solution:

http://forum.coppermine-gallery.net/index.php?topic=30221.0

But that's not exactly what I'm looking for

cheers and thanks

Michael
« Last Edit: May 25, 2006, 07:16:33 pm by Paver »
Logged

Paver

  • Dev Team member
  • Coppermine addict
  • ****
  • Country: us
  • Offline Offline
  • Gender: Male
  • Posts: 1609
  • Paul V.
Re: Add pic title to breadcrumb
« Reply #1 on: May 25, 2006, 06:03:33 pm »

Huh.  There's another theme customization that doesn't exist in sample/theme.php.  That's weird.

So, yeah, here's a theme customization that should do what you want.  Add the following function to yourtheme/theme.php:
Code: [Select]
function theme_breadcrumb($breadcrumb_links, $BREADCRUMB_TEXTS, &$breadcrumb, &$BREADCRUMB_TEXT)
{
    global $CURRENT_PIC_DATA;

    $breadcrumb = '';
    $BREADCRUMB_TEXT = '';
    foreach ($breadcrumb_links as $breadcrumb_link)
    {
        $breadcrumb .= ' > ' . $breadcrumb_link;
    }
    foreach ($BREADCRUMB_TEXTS as $BREADCRUMB_TEXT_elt)
    {
        $BREADCRUMB_TEXT .= ' > ' . $BREADCRUMB_TEXT_elt;
    }

    if ($CURRENT_PIC_DATA['filename']) {
        // Add picture title to breadcrumb
        $picture_title = $CURRENT_PIC_DATA['title'] ? $CURRENT_PIC_DATA['title'] : strtr(preg_replace("/(.+)\..*?\Z/", "\\1", htmlspecialchars($CURRENT_PIC_DATA['filename'])), "_", " ");
        $breadcrumb .= ' > ' . $picture_title;
        $BREADCRUMB_TEXT .= ' > ' . $picture_title;
    }

    // We remove the first ' > '
    $breadcrumb = substr_replace($breadcrumb,'', 0, 3);
    $BREADCRUMB_TEXT = substr_replace($BREADCRUMB_TEXT,'', 0, 3);
}

I'd like to add this to stable & devel but I guess I should first ask a basic question: this function is referenced in functions.inc.php in function breadcrumb() and so doesn't exist in themes.inc.php.  I think it should go into sample/theme.php as it is a theme customization.  Does this make sense to the other devs?  (The other function I found that's similar to this one in not being in themes.inc.php is theme_create_tabs() which is also in functions.inc.php, discovered while solving this thread.)

edit: Code above replaced with improved code that makes sure you are showing an image so that album breadcrumbs don't have an extra '>'.
« Last Edit: May 25, 2006, 06:32:03 pm by Paver »
Logged

mdssdm

  • Coppermine newbie
  • Offline Offline
  • Posts: 11
Re: Add pic title to breadcrumb
« Reply #2 on: May 25, 2006, 07:04:49 pm »

works like a charm  :D

thanks !!!

Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Add pic title to breadcrumb
« Reply #3 on: May 26, 2006, 08:24:56 pm »

I think it should go into sample/theme.php as it is a theme customization.  Does this make sense to the other devs? 
Makes sense to me. It's a new feature though that should only go into the devel branch imo.
Logged
Pages: [1]   Go Up
 

Page created in 0.019 seconds with 19 queries.