ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Autocrumb - Lightweight Breadcrumb Helper (ver.12.05.1)

December 09, 2009 5:58pm

Subscribe [78]
  • #31 / Feb 24, 2010 10:59am

    123wesweat

    107 posts

    hi ardinotow,

    I fix the last number issue i had but now i have created a major one.

    I added

    require_once './blog/wp-load.php';//WP

    to the index.php as i needed to use WP.

    But now the breadcrumb helper “thinks” mydomain.com/blog is the home url??? I do think site_url() doesn’t give the right url

    Any suggestions how to fix this??

  • #32 / Feb 28, 2010 5:57pm

    ardinotow

    162 posts

    @123wesweat
    Sorry for late reply. Could you share your fix? I also made a modification so that you can use regular expression to replace any character.

    Add these into config/breadcrumb.php

    $config['strip_regexp'] = array ('/[0-9]+.html/');

    Find this code

    $value = ucwords(strtolower(str_replace($char_to_replace, " ", $value)));

    and add below code after that code

    if ($CI->config->item('strip_regexp'))
    {
        foreach($CI->config->item('strip_regexp') as $exp)
        {
            $value = preg_replace($exp, " ", $value);
        }
    }

    For your next problem, do you use .htaccess for WP blog integration ?

  • #33 / Mar 15, 2010 9:40am

    ToMix

    5 posts

    Many thanks for this Helper its realy good,

    i have an issue with replacer

    my Articles management page link : ( http://localhost/ci/artic_manage)


    inside the config file i added array in this line:

    $config[‘replacer’] = array(‘artic_manager’=> ‘ARTICLES’);

    what will hapen with this ?  the (artic_manager) will replace with (ARTICLES) right?

    thats ok with me it did fine..
    but the (ARTICLES) now comes with this link:
    http://localhost/ci/ARTICLES

    insted of:  http://localhost/ci/artic_manage

    whats wrong with The Replacer ??

  • #34 / Mar 19, 2010 2:56am

    ardinotow

    162 posts

    @ToMix:
    Sorry for late answer…You can try new breadcrumb helper version. Please tell me if the problem stil exist.

    Regards,
    Ardinoto Wahono

    Update:
    For anyone that have used this helper please do a backup old helper configuration (config/breadcrumb.php) before copy and replace those files!

  • #35 / Mar 19, 2010 4:05am

    Zeeshan Rasool

    261 posts

    Nice work. i was also in search of a helper for generating breadcrums and hopeful this will be a great thing in this matter.

  • #36 / Mar 19, 2010 5:24am

    ardinotow

    162 posts

    Thx Zeeshan

  • #37 / Mar 29, 2010 2:48pm

    StewyMan

    4 posts

    I tried this helper and it works great except that the replacer creates a url that doesn’t exist on my site.

    for example…if the url was:  http://www.usedcars.com/search/display/florida/orlando

    and I used the replacer to create the following breadcrumb:

    home/usedcars/usa/florida/orlando

    Problem: if a user clicks on the USA link or used cars links (the words that replaced the words in the url string) it would not take them to a page that exists. I.e. It would try to find a page at http://www.usedcars/usa that doesn’t exist.

    Please help!!

  • #38 / Mar 29, 2010 10:00pm

    ardinotow

    162 posts

    @StewyMan
    Could you please write your breadcrumb config files here

  • #39 / Mar 30, 2010 12:17am

    StewyMan

    4 posts

    ardinotow…thanks for your help. I was using your last release dated Mar 19th. Here is the config file i am using. Again, it need to use the old link but with the new replacer text as anchor.

    <?php if ( ! defined(‘BASEPATH’)) exit(‘No direct script access allowed’);

    /*
    *————————————
    * Config: set home
    *————————————
    * Default value:
    * $config[‘set_home’] = “Home”;
    *
    * Change initial breadcrumb link
    */
    $config[‘set_home’] = “Home”;

    /*
    *————————————
    * Config: Delimiter
    *————————————
    * Default value:
    * $config[‘delimiter’] = ’ > ‘;
    */
    $config[‘delimiter’] = “>”;

    /*
    *—————————————
    * Config: Replacer
    *—————————————
    * Default value:
    * $config[‘replacer’] = array();
    *
    * Can either change controller name to the proper name for link label or hide it
    * Example:
    * Suppose we have module name: warehouse, controller name: stocks and method name: search_direct
    * So, if we want to call search_direct, we should type :
    * “http://localhost/arstock/warehouse/stocks/search_direct” in url address. From this URL,
    * Breadcrumb helper will produce: Home > Warehouse > Stocks > Search_direct. Noticed that the last link
    * is not a common link name. This is where Replacer can be very useful to change link name into anything we like.
    * Set the Replacer:
    * $replacer = array(‘search_direct’ => ‘edit’)
    * Above line will change the breadcrumb into: Home > Warehouse > Stocks > Edit.
    * What if we need to hide Warehouse link from breadcrumb ? Just add the Replacer into:
    * $replacer = array(‘search_direct’ => ‘edit’, ‘warehouse’ => ‘’)
    * This will change breadcrumb into: Home > Stocks > Edit
    */
    $config[‘replacer’] = array(’‘);

    /**
    *—————————————
    * Config: Exclude
    *—————————————
    * Default value:
    * $config[‘exclude’] = array(’‘);
    *
    * Can hide links that written in array
    * Example:
    * If we set $config[‘exclude’] = array(‘stocks’, ‘warehouse’) then from this URL “http://localhost/arstock/warehouse/stocks/insert”
    * we get breadcrumb: Home > Insert
    */
    $config[‘exclude’] = array(‘in’, ‘insert’);

    /**
    *——————————————————
    * Config: Exclude Segment
    *——————————————————
    * Default value:
    * $config[‘exclude_segment’] = array();
    *
    * Can hide segments
    * Example:
    * Look at this example URL:
    * http://mysite.com/en/search/results
    * http://mysite.com/fr/search/results
    * If we set $config[‘exclude’] = array(1) then everything in segment 1 which are ‘en’ & ‘fr’ will be hide. We get breadcrumb:
    * Home > Search > Results
    */
    $config[‘exclude_segment’] = array();

    /**
    *—————————————
    * Config: Wrapper
    *—————————————
    * Default value:
    * $config[‘use_wrapper’] = FALSE;
    * $config[‘wrapper’] = ‘<ul>|</ul>’;
    * $config[‘wrapper_inline’] = ‘<li>|</li>’;
    *
    * We set this if we want to make breadcrumb have it’s own style.
    * it possible to return the breadcrumb in a list (<ul><li></li></ul>) or something else as configure below.
    * Set use_wrapper to TRUE to use this feature.
    */
    $config[‘use_wrapper’] = FALSE;
    $config[‘wrapper’] = ‘<ul id=“crumbs” [removed]>|</ul>’;
    $config[‘wrapper_inline’] = ‘<li [removed]>|</li>’;

    /**
    *——————————-
    * Config: Unlink
    *——————————-
    * Default value:
    * $config[‘unlink_last_segment’] = FALSE;
    *
    * If set to TRUE then the last segment in breadcrumb will not have a link.
    */
    $config[‘unlink_last_segment’] = FALSE;

    /**
    *——————————-
    * Config: Hide number
    *——————————-
    * Default value:
    * $config[‘hide_number’] = TRUE;
    *
    * If set to TRUE then any number without a word in a segment will be hide.
    * Example: http://mysite.com/blog/2009/08/7-habbits/
    * will have breadcrumbs: Home > Blog > 7 Habbits
    * Otherwise if set to FALSE it will produce: Home > Blog > 2009 > 08 > 7 Habbits
    * Notes: If the last segment is a number then it always shown whether this config
    * set to TRUE or FALSE
    */
    $config[‘hide_number’] = TRUE;

    /**
    *————————————-
    * Config: Strip characters
    *————————————-
    * Default value:
    * $config[‘strip_characters’] =  array (‘_’, ‘-’, ‘.html’, ‘.php’, ‘.htm’);
    *
    * All characters in the array will be stripped from breadcrumbs
    * Example: http://mysite.com/blog/7-habbits/request.html
    * will have breadcrumbs: Home > Blog > 7 Habbits > Request
    */
    $config[‘strip_characters’] = array (‘_’, ‘-’, ‘.html’, ‘.php’, ‘.htm’);

    /**
    *——————————————————
    * Config: Strip by Regular Expression
    *——————————————————
    * Default value:
    * $config[‘strip_regexp’] =  array ();
    *
    * All regular expression in the array will be stripped from breadcrumbs
    * Example: http://mysite.com/blog/7-habbits/request-300.html
    * set config to: $config[‘strip_regexp’] =  array (’/-[0-9]+.html/’);
    * then we will have breadcrumbs: Home > Blog > 7 Habbits > Request
    */
    $config[‘strip_regexp’] = array (’/-[0-9]+.html/’);

    /* End of file breadcrumb.php */

  • #40 / Mar 30, 2010 12:39am

    ardinotow

    162 posts

    @StewyMan,
    Maybe you choose the wrong files to paste here because I don’t see any replacer value…

    $config['replacer'] = array('');
  • #41 / Mar 30, 2010 11:18am

    StewyMan

    4 posts

    Sorry i had deleted that part to show you just the base file I used…..here is what i used for replacer:

    $config[‘replacer’] = array(‘browse’ => ‘outdoor guides’);

  • #42 / Mar 30, 2010 9:49pm

    ardinotow

    162 posts

    StewyMan, how can you make breadcrumb from http://www.usedcars.com/search/display/florida/orlando to home > usedcars > usa > florida > orlando if there is no replace value for “search” or “display” in your $config[‘replacer’] ?

  • #43 / Mar 30, 2010 11:44pm

    StewyMan

    4 posts

    ardinow….that was just an example to explain what i meant. that is not my real site. Is the replacer text supposed to link back to original url string

  • #44 / Mar 31, 2010 1:00am

    ardinotow

    162 posts

    @StewyMan. The replacer simply read url string then check every part of url, if found any text that match value from $config[‘replacer’] then it will replace the text but the original url link will remain the same.
    For example:
    http://mysite.com/search/car/BMW. If you set

    $config['replacer'] = array('search' => 'Search Result');

    then the breadcrumb will show Home > Search Result > Car > BMW. If user click Search Result then user will go to page http://mysite.com/search, if user click Car then user will go to page http://mysite.com/search/car.

  • #45 / Apr 03, 2010 4:32am

    ToMix

    5 posts

    Hi ardinotow ,

    I got something wrong and i am going to explain it with this example :

    my url is : http://mysite.com/ci/admin/users_accounts

    i set the replacer like this:

    $config[‘replacer’] = array(‘admin’ => ‘Admin Area’, ‘users_accounts’ => ‘Manage Users’);

    then the breadcrumb will show   :

    Home > Admin Area > Manage Users

    If user click on Admin Area then user will go to page http://mysite.com/ci/Admin Area, <- 404 page will shown cuse its not located on server.It should take the user to the correct page http://mysite.com/ci/admin. else if user click Manage Users then user will go to page http://mysite.com/ci/admin/Manage Users.

    What do u think the problem comes from !!

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases