Connecting Tech Pros Worldwide Help | Site Map

breadcrumb classes.

Eric
Guest
 
Posts: n/a
#1: Jul 17 '05
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
Guest
 
Posts: n/a
#2: Jul 17 '05

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.php?options{/b}", "||");

function breadcrumb($data,$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.

Newbie
 
Join Date: Oct 2005
Posts: 1
#3: Oct 12 '05

re: breadcrumb classes.


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).
Expand|Select|Wrap|Line Numbers
  1. <?
  2. $fullPath = '/home/traeonna.com/public_html/ayablue';
  3. $dir = $_GET['dir'];
  4. $page = $_GET['page'];
  5. if(!isset($dir)) {
  6.  $dir = 'home';
  7.  $page = 'index';
  8.  }
  9. ?>
  10.  
Here are my includes for content, title, and navigation.
Expand|Select|Wrap|Line Numbers
  1. <? include($fullPath . '/' . $dir . '/' . $page . '.php'); ?>
  2.  
  3. <? include($fullPath . '/' . $dir . '/' . $page . '_title.php'); ?>
  4.  
  5. <? include($fullPath . '/' . $dir . '/' . $dir . '_nav.php'); ?>
  6.  
An example of how the URL looks...
http://ayablue.traeonna.com/index.php?dir=portfolio_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.
Closed Thread


Similar PHP bytes