Jump to content


Photo

bread crumb navigation


  • Please log in to reply
7 replies to this topic

#1 vbnullchar

vbnullchar
  • Members
  • PipPipPip
  • Advanced Member
  • 428 posts
  • LocationPasig City, Philippines

Posted 10 October 2006 - 09:38 AM

anyone has a bread crumb script?
that can make something like this

PHP Freaks Forums >> PHP and MySQL >> PHP Help >> Start new topic

Registered Linux User #399942
Ubuntu User #14134
--
my blog

#2 HuggieBear

HuggieBear
  • Members
  • PipPipPip
  • Advanced Member
  • 1,899 posts
  • LocationEngland, UK

Posted 10 October 2006 - 09:42 AM

There's a couple of nice ones here:

Hotscripts

Regards
Huggie
Advice to MySQL users: Get phpMyAdmin and test your queries work there first, take half the hassle out of diagnosis, also check the reserved words list.

Links: PHP Docs :: RegEx's :: MySQL :: DevGuru :: w3schools

#3 vbnullchar

vbnullchar
  • Members
  • PipPipPip
  • Advanced Member
  • 428 posts
  • LocationPasig City, Philippines

Posted 10 October 2006 - 10:16 AM

i got 2 hits but they're not the one im looking for
Registered Linux User #399942
Ubuntu User #14134
--
my blog

#4 HuggieBear

HuggieBear
  • Members
  • PipPipPip
  • Advanced Member
  • 1,899 posts
  • LocationEngland, UK

Posted 10 October 2006 - 10:19 AM

Did you try this one, it's advanced and has lots of configurable options...

http://www.baskettca...ses/breadcrumb/

If it's not what you're after, perhaps a better explanation is in order?

Regards
Huggie
Advice to MySQL users: Get phpMyAdmin and test your queries work there first, take half the hassle out of diagnosis, also check the reserved words list.

Links: PHP Docs :: RegEx's :: MySQL :: DevGuru :: w3schools

#5 vbnullchar

vbnullchar
  • Members
  • PipPipPip
  • Advanced Member
  • 428 posts
  • LocationPasig City, Philippines

Posted 10 October 2006 - 10:58 AM

still no. 

I wanted to create a navigation similar to this, where you can just click the previous level

PHP Freaks Forums > PHP and MySQL > PHP Help > bread crumb navigation
Registered Linux User #399942
Ubuntu User #14134
--
my blog

#6 GremlinP1R

GremlinP1R
  • Members
  • PipPipPip
  • Advanced Member
  • 62 posts
  • LocationSouth Africa

Posted 10 October 2006 - 11:29 AM

There you go hope it will help you

<?php
$id = $_GET['id'];
if ( strlen( $id ) < 1 )
$id = "home";

$pages = array(
home => array( id=>"home", parent=>"", title=>"Home",
url=>"showpage.php?id=home" ),
users => array( id=>"users", parent=>"home", title=>"Users",
url=>"showpage.php?id=users" ),
jack => array( id=>"jack", parent=>"users", title=>"Jack",
url=>"showpage.php?id=jack" )
);

function breadcrumbs( $id, $pages )
{
  $bcl = array( );
  $pageid = $id;
  while( strlen( $pageid ) > 0 )
  {
$bcl[] = $pageid;
$pageid = $pages[ $pageid ]['parent'];
  }
  for( $i = count( $bcl ) - 1; $i >= 0; $i-- )
  {
$page = $pages[$bcl[$i]];
if ( $i > 0 )
{
echo( "<a href=\"" );
echo( $page['url'] );
echo( "\">" );
}
echo( $page['title'] );
if ( $i > 0 )
{
echo( "</a> | " );
}
  }
  }
  ?>
  <html>
  <head>
  <title>Page - <?php echo( $id ); ?></title>
  </head>
  <body>
  Breadcrumbs: <?php breadcrumbs( $id, $pages ); ?><br/>
  Page name: <?php echo( $id ); ?>
  </body>
  </html>


#7 HuggieBear

HuggieBear
  • Members
  • PipPipPip
  • Advanced Member
  • 1,899 posts
  • LocationEngland, UK

Posted 10 October 2006 - 11:41 AM

still no. 

I wanted to create a navigation similar to this, where you can just click the previous level

PHP Freaks Forums > PHP and MySQL > PHP Help > bread crumb navigation


OK, I don't know if you didn't read the page where I sent you or just didn't understand, but the link I posted was to some code for breadcrumb navigation that allows you to click the previous levels.  There were even over 25 examples when showing the different options with the code.

I think I'm going to have to bail out of this one, good luck with finding what you're after

Regards
Huggie
Advice to MySQL users: Get phpMyAdmin and test your queries work there first, take half the hassle out of diagnosis, also check the reserved words list.

Links: PHP Docs :: RegEx's :: MySQL :: DevGuru :: w3schools

#8 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 10 October 2006 - 01:22 PM

Store the bread crumbs in an array like this:
$nav[] = array('Main page','index.php');
$nav[] = array('Some other page','index.php?page=some_other');
$nav[] = array('Yet another page');

Then when generating the bread crumbs do this:
<?php
foreach($nav as $bc)
{
	$nav2[] = empty($bc[1]) ? $bc[0] : "<a href='{$bc[1]}'>{$bc[0]}</a>";
}

echo "<div id='bread_crumbs'>".join(' &gt; ',$nav2)."</div>";
?>





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users