hello all,
I'm somewhat new tophp and i'm working on a small classified script for my website. I'm found good breadcrumb script and need help modifying it to fit mysite.
right now i'm testing the scrip on my local PC(apache,php,mysql).
the script works awesome but not sure how to modify to fit my classified script.
PhP scripts are located at: http://192.168.0.101/classified/
http://192.168.0.101/classified//index.php , i added the breadcrumb function:
breadcrumb('Classified', ' >> ', false, false)
after running it it displays the the following:
Classified >> Classified >>
how do i just display the classified rather the the url and classified i entered in the breadcrumb?
sec problem:
when i click on a category it goes to page_2 (as it should) but it displays:
page2 >> Classified >> Page_2.php?subcat=Housing
it moves page2 in front of classified(which is the main page) but it should look like this: classified>>page2>> etc
main page is index.php(classifed which lists all the categories). example of a categorie is house. when i click on a house it takes me to page_2.php to display sub categories.
any help you can give me would be greatly appreciated.
Thanks
robin
<?php
function breadcrumb(
$home = 'Home', // Name of root link
$division = ' / ', // Divider between links
$hidextra = true, // Toggle hide/show get data and fragment in text
$index = false, // Toggle show/hide link to directory if it does not contain a file
$indexname = 'index.php' // The definition of the file the directory must contain
) {
$whole = $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
$parts = explode('/', $whole);
$parts[0] = 'http://'.$parts[0];
$breadcrumb .= '<a href="'.$parts[0].'">'.$home.'</a>'.$division;
$k = 1;
for ($i=1;$i < sizeof($parts);$i++) {
$uri = '/';
while ($k <= $i) {
$uri .= $parts[$k];
if ($k != (sizeof($parts)-1)) $uri .= '/';
$k++;
}
if ($index && is_dir($_SERVER['DOCUMENT_ROOT'].$uri) && is_file($_SERVER['DOCUMENT_ROOT'].$uri.$indexname)
|| !$index
|| !is_dir($_SERVER['DOCUMENT_ROOT'].$uri)) {
$breadcrumb .= '<a href="'.$uri.'">';
if ($hidextra) {
$breadcrumb .= implode('', array_slice(explode('?', ucfirst($parts[$i])), 0, -1));
}
else {
$breadcrumb .= ucfirst($parts[$i]);
}
$breadcrumb .= '</a>';
}
else {
$breadcrumb .= ucfirst($parts[$i]);
}
if (isset($parts[($i+1)])) {
$breadcrumb .= $division;
}
$k = 1;
}
return $breadcrumb;
}
?>