Add pic title to breadcrumb Add pic title to breadcrumb
 

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

Main Menu

Add pic title to breadcrumb

Started by mdssdm, May 25, 2006, 05:09:06 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

mdssdm

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

Paver

#1
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:
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 '>'.

mdssdm

works like a charm  :D

thanks !!!


Joachim Müller

Quote from: Paver on May 25, 2006, 06:03:33 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.