breadcrumb classes.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Eric

    breadcrumb classes.

    I am looking for a breadcrumb class in PHP that does not rely on the
    directory structure to build the trail.

    I have been using Richard Baskettes -
    http://www.baskettcase.com/classes/breadcrumb/ - breadcrumb classes and
    they are great... BUT. I have a site that is being built using
    templates and the directory hierarchy can not be used to create the
    trail.

    Sorry if you read this post in alt.lang.php.

    Thanks.


  • justin.shreve@gmail.com

    #2
    Re: breadcrumb classes.

    Is a class really needed for breadcrumbs? For my blog navigation (my
    weblog script) I simply just use a function that goes along with my
    template engine.

    Example:

    <?php
    $output = breadcrumb("{b Index}index.php {/b} {s} {b
    Options}index.p hp?options{/b}", "||");

    function breadcrumb($dat a,$sep) {
    $breadcrumb = str_replace("{s }", $sep, $data);
    $breadcrumb = preg_replace("# {b (.*?)}(.*?){/b}#s", "<a
    href=\"\\2\">\\ 1</a>", $breadcrumb);
    return $breadcrumb;
    }


    print($output);
    ?>

    Will create a simple breadcrum setup, and you could just display the
    navigation depending on the page load (example):

    $output = breadcrumb("{b
    ".$_GET['id']."}index.php?id =".$_GET['id']."{/b}", "||");
    Depends on how advanced you want to get.

    Comment

    • Traeonna
      New Member
      • Oct 2005
      • 1

      #3
      I've been looking for something similar. See I pretty much design a "template" then call certain information such as content, title, and navigation.

      Placed before <html> on index.php in root (this is my template file).
      Code:
      <?
      $fullPath = '/home/traeonna.com/public_html/ayablue';
      $dir = $_GET['dir'];
      $page = $_GET['page'];
      if(!isset($dir)) {
       $dir = 'home';
       $page = 'index';
       }
      ?>
      Here are my includes for content, title, and navigation.
      Code:
      <? include($fullPath . '/' . $dir . '/' . $page . '.php'); ?>
      
      <? include($fullPath . '/' . $dir . '/' . $page . '_title.php'); ?>
      
      <? include($fullPath . '/' . $dir . '/' . $dir . '_nav.php'); ?>
      An example of how the URL looks...
      http://ayablue.traeonn a.com/index.php?dir=p ortfolio_amanda &page=fb_sa

      I would like a breadcrumb as such...
      Home > Amanda's Portfolio > Fruits Basket - Ayame Sohma

      It seems that all the breadcrumb stuff I've found will not work with this current system. I'm sure there's a way around this, but I'm just not that well versed in PHP.

      Comment

      Working...