By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,983 Members | 2,082 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,983 IT Pros & Developers. It's quick & easy.

breadcrumb classes.

P: n/a
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 - - 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

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

Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies

P: n/a
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.


$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;

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.

Jul 17 '05 #2

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

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.
Oct 12 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.