Page 1 of 1

how to add item to breadcrumb

Posted: Sun May 17, 2009 4:55 am
by aneuryzma
Hi,

I have a breadcrumbs bar and I want to dynamically add the items to it.
I was wondering how to assign the current page <title> tag into the breadcrumb.
I can easily add the link to the current page using $_SERVER[PHP_SELF];

thanks

Code: Select all

<?php
$currentPage = $_SERVER[PHP_SELF];
?>
 
<div id="breadcrumb">
    <a id="primaBread" href="index.php">Home page</a>
    <a href="<?php echo $currentPage ?>"><?php echo $currentPage ?></a>
</div>

Re: how to add item to breadcrumb

Posted: Sun May 17, 2009 8:02 pm
by Gabriel
PHP_SELF is a server variable that is returned to PHP by the web server. So unfortunately, you won't be able to retrieve the title tags without them being assigned by a variable of a sort. Set your title to a variable and call the variable in your breadcrumbs bar. There are other ways but I'd need to know more information about how your website displays pages and what-not.