forum.coppermine-gallery.net

Support => cpg1.5.x Support => cpg1.5 themes (visuals) => Topic started by: cherokee on February 22, 2014, 10:57:11 am

Title: How I can change the separator breadcrumb a picture?
Post by: cherokee on February 22, 2014, 10:57:11 am
How I can change the separator breadcrumb a picture?
In includes / function.inc found in this code, but I can not replace the symbol with a picture.
Code: [Select]
//Add Link for album if aid is set
    if (isset($CURRENT_ALBUM_DATA['aid'])) {
        $breadcrumb_links[$cat_order] = "<a href=\"thumbnails.php?album=".$CURRENT_ALBUM_DATA['aid']."\">".$CURRENT_ALBUM_DATA['title']."</a>";
        $BREADCRUMB_TEXTS[$cat_order] = $CURRENT_ALBUM_DATA['title'];
    }
Site tests:http://www.rutasytravesias.com/galeria (http://www.rutasytravesias.com/galeria)
Thanks
Regards
Title: Re: How I can change the separator breadcrumb a picture?
Post by: allvip on February 27, 2014, 02:57:38 pm
The code for breadcumb is in theme.php not in include (all coppermine function are in themes/sample/theme.php.If you want to edit something find the right function in the sample theme,paste it in your theme and edit it)

This is the function theme_breadcrumb for breadcumb:

Code: [Select]
/******************************************************************************
** Section <<<theme_breadcrumb>>> - START
******************************************************************************/
// Function for building the breadcrumb
// Inputs:  $breadcrumb_links, $BREADCRUMB_TEXTS
// Outputs: $breadcrumb, $BREADCRUMB_TEXT
function theme_breadcrumb($breadcrumb_links, $BREADCRUMB_TEXTS, &$breadcrumb, &$BREADCRUMB_TEXT)
{
    $breadcrumb = '';
    $BREADCRUMB_TEXT = '';
    foreach ($breadcrumb_links as $breadcrumb_link) {
        $breadcrumb .= ' > ' . $breadcrumb_link;
    }
    foreach ($BREADCRUMB_TEXTS as $BREADCRUMB_TEXT_elt) {
        $BREADCRUMB_TEXT .= ' > ' . $BREADCRUMB_TEXT_elt;
    }
    // We remove the first ' > '
    $breadcrumb = substr_replace($breadcrumb,'', 0, 3);
    $BREADCRUMB_TEXT = substr_replace($BREADCRUMB_TEXT,'', 0, 3);
}
/******************************************************************************
** Section <<<theme_breadcrumb>>> - END
******************************************************************************/


or this code for function breadcumb made by Andre that changes the breadcumb structure:

 http://forum.coppermine-gallery.net/index.php/topic,76955.0.html (http://forum.coppermine-gallery.net/index.php/topic,76955.0.html)
Title: Re: How I can change the separator breadcrumb a picture?
Post by: allvip on February 27, 2014, 03:23:14 pm
How to edit function breadcumb:

the line $breadcrumb .= ' > ' . $breadcrumb_link; has the > that shows in the breadcumb

 $BREADCRUMB_TEXT .= ' > ' . $BREADCRUMB_TEXT_elt; has the > that shows up in the browser tab

 $breadcrumb = substr_replace($breadcrumb,'', 0, 3); is to hide > that shows before the word Home (3 is the number of characters to hide. ' > ' has 3 characters.)


I REMOVED ALL MY POSTS with code because Andre posted the right way to do this.
I only let this post for users that need to understand the code.

Title: Re: How I can change the separator breadcrumb a picture?
Post by: cherokee on February 27, 2014, 06:49:54 pm
hello.
Thanks for your interest. I will make the changes.
regards
Title: Re: How I can change the separator breadcrumb a picture?
Post by: cherokee on February 27, 2014, 06:52:19 pm
Sorry.
We were writing about the same time.
I'll try the change you propose.
Thank you again.
Sorry for my english
Title: Re: How I can change the separator breadcrumb a picture?
Post by: Αndré on February 28, 2014, 12:22:02 pm
I suggest to store the image's HTML code in a variable like
Code: [Select]
$separator = '<img src="themes/panzajoteros/images/navbit-arrow-right.png"/>';and then use
Code: [Select]
strlen($separator)to let PHP count the number of characters for you.

Note that allvip's code still contains some custom modifications, so it's maybe not exactly what you're looking for. That's why I suggest to add this code to your theme's theme.php file:
Code: [Select]
/******************************************************************************
** Section <<<theme_breadcrumb>>> - START
******************************************************************************/
// Function for building the breadcrumb
// Inputs:  $breadcrumb_links, $BREADCRUMB_TEXTS
// Outputs: $breadcrumb, $BREADCRUMB_TEXT
function theme_breadcrumb($breadcrumb_links, $BREADCRUMB_TEXTS, &$breadcrumb, &$BREADCRUMB_TEXT)
{
    $breadcrumb = '';
    $BREADCRUMB_TEXT = '';
    $separator = '<img src="themes/panzajoteros/images/navbit-arrow-right.png" />';
    foreach ($breadcrumb_links as $breadcrumb_link) {
        $breadcrumb .= $separator . $breadcrumb_link;
    }
    foreach ($BREADCRUMB_TEXTS as $BREADCRUMB_TEXT_elt) {
        $BREADCRUMB_TEXT .= $separator . $BREADCRUMB_TEXT_elt;
    }
    // We remove the first $separator
    $breadcrumb = substr_replace($breadcrumb,'', 0, strlen($separator));
    $BREADCRUMB_TEXT = substr_replace($BREADCRUMB_TEXT,'', 0, strlen($separator));
}
/******************************************************************************
** Section <<<theme_breadcrumb>>> - END
******************************************************************************/