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]
  • #1 / Dec 09, 2009 5:58pm

    ardinotow's avatar

    ardinotow

    162 posts

    Please let me introduce the simplest ever breadcrumb helper. It just take 5 minutes to make the helper run. Grab it, install, and see the breadcrumb work. Hope this litte script can help you a lot…

    ** Version History **
    Version 12.05.1 - Date released 17-May-12 - http://ellislab.com/forums/viewreply/1003857/
    Version 12.02.1 - Date released 1-April-12 - http://ellislab.com/forums/viewreply/992246/
    Version 12.01.1 - Date released 5-Jan-12 - http://ellislab.com/forums/viewreply/967139/
    Version 6.11.1 - Date released 10-Jun-11 - http://ellislab.com/forums/viewreply/902953/
    Version 3.11.1 - Date released 5-Mar-11 - http://ellislab.com/forums/viewreply/864920/
    Version 9.10.1 - Date released 18-Sept-10 - http://ellislab.com/forums/viewreply/801599/
    Version 5.10.1 bug fixed - Date released 19-Aug-10 - http://ellislab.com/forums/viewreply/789391/
    Version 5.10.1 - Date released 4-May-10 - http://bitbucket.org/ardinotow/autocrumb/downloads - Related article http://ellislab.com/forums/viewreply/742825/
    Version 4.10.1 - Date released 4-Apr-10 - http://ellislab.com/forums/viewreply/734004/
    Version 3.1.0 - Date released 19-Mar-10 - http://ellislab.com/forums/viewreply/727462/
    Version 2.0.0 - Date released 05-Feb-10 - http://ellislab.com/forums/viewreply/708069/
    Version 1.0.4 - Date released 13-Jan-10 - http://ellislab.com/forums/viewreply/695221/
    Version 1.0.3 - Date released 12-Jan-10 - http://ellislab.com/forums/viewreply/694475/
    Version 1.0.2 - Date released 14-Dec-09 - http://ellislab.com/forums/viewreply/682597/
    Version 1.0.1 - Date released 13-Dec-09 - http://ellislab.com/forums/viewreply/682034/
    Version 1.0.0 - Date released 10-Dec-09 - Link has been removed.

    ** How-To Install **
    1. Put breadcrumb_helper.php to application/helpers.
    2. Put breadcrumb.php to application/config.
    3. Load the helper either in your controller or in autoload config.
      In your controller   : $this->load->helper(‘breadcrumb’) OR
      In autoload : $autoload[‘helper’] = array(‘breadcrumb’)
    4. Add these line to your view file: <?php echo set_breadcrumb(); ?>. I suggest that you put it on master template so that it can save time as you don’t need to add text in every view page.
    5. Change the configuration as you need.

    ** NEWS **
    Now autocrumb is available on bitbucket! Version 4.10.1 and later can be downloaded via bitbucket. Here is the link: http://bitbucket.org/ardinotow/autocrumb/

    ** MY PAYPAL LINK **

    Paypal Donations

  • #2 / Dec 10, 2009 2:33am

    GrimReaper's avatar

    GrimReaper

    8 posts

    Hi ardinotow,

    Good job! although I still get an error when I fill $replacer variable and I use .htaccess a lot to change the original CI URL, so maybe it’s better if we change :
    $uri = $CI->uri->uri_string();
    to
    $uri = $_SERVER[‘REQUEST_URI’];

  • #3 / Dec 10, 2009 5:45am

    ardinotow's avatar

    ardinotow

    162 posts

    Hi ardinotow,

    Good job! although I still get an error when I fill $replacer variable and I use .htaccess a lot to change the original CI URL, so maybe it’s better if we change :
    $uri = $CI->uri->uri_string();
    to
    $uri = $_SERVER[‘REQUEST_URI’];

    Thanks for your feedback. i should check it again while i’m still waiting for more feedback from you guys…

  • #4 / Dec 10, 2009 12:32pm

    ardinotow's avatar

    ardinotow

    162 posts

    By default, URLs in CodeIgniter are designed to be search-engine and human friendly. Rather than using the standard “query string” approach to URLs that is synonymous with dynamic systems, CodeIgniter uses a segment-based approach:

    example.com/news/article/my_article

    So, if you follow standard CI URLs and not using heavy mod_rewrite then teoritically you have no difficulties in using my breadcrumb helper.
    Any thought guys?...Let me know

    Cheers,
    Ardinoto W

  • #5 / Dec 11, 2009 7:24am

    GrimReaper's avatar

    GrimReaper

    8 posts

    I’m aware about how difficult to create a breadcrumb link from non-standard CI Url, but mod_rewrite can change my URL to become more meaningful and get more credits in SEO.

    assuming my website article was multilanguage, english and spanish:

    example.com/history/en/23 (english)
    and
    example.com/history/sp/23 (spanish)

    by using php to create meaningful link and mod_rewrite, I can make my URL like

    example.com/history/green-apple-23
    and
    example.com/historia/manzana-verde-23

    Once again, good job for your helper! I will try to tweak it later and post it here if I succeed.

  • #6 / Dec 11, 2009 10:01am

    ardinotow's avatar

    ardinotow

    162 posts

    GrimReaper, glad you like it and feel free to tweak it 😊

  • #7 / Dec 12, 2009 6:08am

    ardinotow's avatar

    ardinotow

    162 posts

    Feedbacks and comments are very appreciated….

  • #8 / Dec 12, 2009 7:19am

    CtheB

    69 posts

    Hi, I will give you some feedback.

    It’s real simple, and really easy. It only needs some more options to set.

    For instance i have url’s like this:

    http://mysite.com/en/search/results
    http://mysite.com/fr/search/results
    http://mysite.com/de/search/results
    http://mysite.com/es/search/results
    http://mysite.com/it/search/results

    My breadcrumb will be like this:

    Home > En > Search > Results
    Home > Fr > Search > Results
    Home > De > Search > Results
    Home > Es > Search > Results
    Home > It > Search > Results

    So i do have 2 recommendations:

    1. Make it possible to give an array with segment and string to exclude from breadcrumb.

    so for instance:

    $exclude = array('1' => 'en', '1' => 'fr', '1' => 'de', '1' => 'es', '1' => 'it')
    
    ar_breadcrumb($exclude);

    2.  Make it possible to set the delimiter in a parameter like this:

    $delimiter = ' | ';
    ar_breadcrumb($exclude, $delimiter);

    3. Change the name of the helper to something more meaningfull, like all the other codeigniter helpers like this:

    set_breadcrumb($exclude, $delimeter);

    4. Start the file with another line like all codeigniter helpers like this:

    if ( ! function_exists('set_breadcrumb'))
    {
    function set_breadcrumb(($exclude = array(), $delimeter = ' > ')
    {

    5. Make it possible to return the breadcrumb in a list (<ul><li></li></ul>) or something else, whatever is required.

    Good luck, if you need some more help please ask:)

  • #9 / Dec 12, 2009 8:42pm

    ardinotow's avatar

    ardinotow

    162 posts

    ** BREADCRUMB HELPER VERSION 1.0.1 **

    New features:
    - Easy integration. Just put <?php echo set_breadcrumb(); ?> in view files.
    - Can use any delimiter.
    - Easy to replace any unproper link name.
    - Easy to hide any link by it’s name or number segment (new).
    - Return the breadcrumb in a list (<ul><li></li></ul>) or something else (new).


    What this helper can do for you:
    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 automagically produce: Home > Warehouse > Stocks > Search_direct.

    Oops, I think the last link is not a common link name. No problem, this is where Replacer can be very useful to change link name into anything we like.
    Set the Replacer in breadcrumb.php located on config folder into:

    $config['replacer'] = array('search_direct' => 'edit');

    That configuration will change the breadcrumb into: Home > Warehouse > Stocks > Edit.


    What if we need to hide Warehouse link from breadcrumb ? Just set the Replacer OR Exclude into:

    $config['replacer'] = array('search_direct' => 'edit', 'warehouse' => '');

    OR

    $config['exclude'] = array('warehouse');

    Both will change breadcrumb into: Home > Stocks > Edit


    Hey, I need to hide all link in second segment of my URL what should I do? Instead of using Replacer or Exclude, you may use other configuration which is Exclude Segment. For example:

    $config['exclude_segment'] = array(2);


    More configuration information can be found on config/breadcrumb.php that I believe easy to understand and configure.


    Installation:
    1. Put breadcrumb_helper.php to application/helpers.
    2. Put breadcrumb.php to application/config.
    3. Load the helper either in your controller or in autoload config.
      In your controller   : $this->load->helper(‘breadcrumb’) OR
      In autoload : $autoload[‘helper’] = array(‘breadcrumb’)
    4. Add these line to your view file: <?php echo set_breadcrumb(); ?>. I suggest that you put it on master template so that it can save time as you don’t need to add text in every view page.
    5. Change the configuration as you need.


    As usually, feedback, comment, or questions are welcome.

    Enjoy and cheers,
    Ardinoto
    ———————————————————————————————————————————-
    NB: CtheB thanks for your feedback. It’s very inspiring me to make an update to version 1.0.1 that mostly covers your request 😊.

  • #10 / Dec 14, 2009 6:42am

    mattpointblank's avatar

    mattpointblank

    157 posts

    Not bad. Maybe add some ability to make strings look a little nicer automatically? Eg convert ‘search_direct’ to ‘Search Direct’ (without adding it into the config manually)?

  • #11 / Dec 14, 2009 1:35pm

    ardinotow's avatar

    ardinotow

    162 posts

    Not bad. Maybe add some ability to make strings look a little nicer automatically? Eg convert ‘search_direct’ to ‘Search Direct’ (without adding it into the config manually)?

    Thanks, I’ve made new updates

    ** Breadcrumb Helper 1.0.2 **

    New Features:
    1. Auto link beauty. E.g. if we have ‘search_direct’ as a segment in URL then it automatically convert to ‘Search Direct’ without using $config[‘replacer’].
    2. Can unlink the last segment of breadcrumb. If $config[‘unlink_last_segment’] set to TRUE then the last segment in breadcrumb will not have a link.

    Enjoy,
    Ardinoto

    -Feedback, comments, and feature request are welcome-

  • #12 / Dec 14, 2009 2:28pm

    mattpointblank's avatar

    mattpointblank

    157 posts

    Fast work! Thanks.

  • #13 / Dec 14, 2009 5:34pm

    ardinotow's avatar

    ardinotow

    162 posts

    You’re welcome 😊

  • #14 / Dec 15, 2009 10:47pm

    Tooker

    3 posts

    Awesome.

  • #15 / Dec 16, 2009 8:40pm

    ardinotow's avatar

    ardinotow

    162 posts

    Awesome.

    Glad you like it. Still need more feedback guys…

ExpressionEngine News

#eecms, #events, #releases