PHP Breadcrumbs

I have spent hours searching google, youtube and other resources to find a good, easy to follow tutorial on creating a breadcrumb trail navigation system in PHP but as yet haven’t found it. Does anyone know of any such website, video cast that will be able to help me? If not then anyone want to help me into the right direction of where to start and what kind of techniques I should be looking at?

Any help would be really appreciated as always.

Is this an addition for an existing site, or is it for something you are planning?

building a new site from scratch and just need to know which direction to go and what to process to take

Will all the content come from a db, or will it be using files in the directory structure of the OS?

Further …

If the answer is database, maybe if you can explain how you see the “folder/folder/file” structure evolving in your database, then we can suggest ways of doing this.

Is your data to be “polyhierarchical” ie. some content can appear in more than one path.

/articles/people/Obama

/articles/politics/Obama

Might help if you explain what kind of site it is in general. A CMS? A blog? A gallery of products etc.

Your system must know the hierarchy of any given page, so that it can present the appropriate breadcrumb, which is simply a list of links going up the chain.

How this hierarchy is mapped is the key, usually mapped in the database.

Well you may never get excat as you want but reading these i think you should be able to come up with something
http://stackoverflow.com/questions/2594211/php-simple-dynamic-breadcrumb
http://www.phpriot.com/articles/breadcrumbs
http://www.phpro.org/classes/Breadcrumbs.html

Hi guys,

Sorry for the delay in replying but I have been away. Firstly, yes the content is coming from a database. The content will be products for sale that are placed in categories. The data will be ‘polyhierarchical’. To be honest I never that that doing a breadcrumb could be potentially so complicated! The basic structure will be something like this: ‘brand/brand-model/product’

It need not be complicated, but you are taking what is essentially a file system paradigm (folder/folder/file) and re-enacting it in a database.

If you are serious about a polyhierchical structure so that you can essentially have:

brand1/brand-model1/product1
brand1/brand-model2/product1
brand2/brand-model2/product1

Where product1 is always the same page, but the breadcrumb permits the user to navigate “back up” to either :

brand1/brand-model1 OR
brand1/brand-model2 OR
brand2/brand-model2

… depending on which way they got there, then the best option will be to maintain a referential table which stores all of those possible relationships.

But are you sure that is what you want? Can product1 really belong to many brands?