Jump to content

Category Breadcrumbs?


spidermonster

Recommended Posts

I am trying to make something like breadcrumbs, but using the categories out of my mysql database.

here is the code I have:

 

<?php
$query = "SELECT * FROM class_categories";
$result = mysql_query($query);
$numrows = mysql_num_rows($result);

echo '<a href="http://'.$domain.'/c/index.php"><font size="2">Main Categories</a> : ';
  while($r1 = mysql_fetch_array($result)){ 

    if($r1['id']==$sub){
       echo '<a href="http://'.$domain.'/c/results.php?id='.$sub.'&main='.$main.'"><font size="2">'.$r1['cat'].'</a> : ';
    }

    if($r1['id']==$id){
       echo $r1['cat'].'';
    }

}
?>

 

This actually displays each category that is clicked on...

if one category is clicked, it shows something like the below text:

 

Main Categories : Antiques & Collectibles

 

Now if a subcategory is clicked under Antiques & Collectibles like Dolls, it shows something like the below text:

 

Main Categories : Antiques & Collectibles : Dolls

 

What my problem is, I was wanting to make it better,,, kinda like if I add another subcategory under Dolls, for what type of dolls, it would have something like below:

 

Main Categories : Antiques & Collectibles : Dolls : Rag

 

Or Like:

 

Main Categories : Antiques & Collectibles : Dolls : Porcelain

 

I wanted to use it as a navigation system with my other categories so that its easier for people to view items in classifieds and just be able to click a link from this Categories Breadcrumbs style link system to go back to whatever category they were at before they reach the area that they might be at...

 

I think I made that sound more confusing than it should be,,, I just want to be able to have the categories at the top of the page in a breadbrumbs style, but for unlimited breadcrumbs,, this one only shows 2 of the subcategories in depth.

 

main link to home page : then parent category link : then subcategory1 link

 

when I want :

 

home page link : parent category link : subcategory link : sub-subcategory link : sub-sub-subcategory link : and so on............................

 

 

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/45072-category-breadcrumbs/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.