PHP Site Map Path

It doesn't matter if you do all the error checking in the world, or if you have the most beautiful graphics, if your site or application design isn't usable, it's not going to do well. Get input and advice on usability and user interface issues here.

Moderator: General Moderators

Post Reply
iceangel89
Forum Commoner
Posts: 39
Joined: Mon Jul 02, 2007 7:02 pm

PHP Site Map Path

Post by iceangel89 »

In ASP.NET there is something called SiteMapPath it like to display where the user is relative to the root.

Like
Home > Products > Softwares

how do i do this in PHP? i see it in quite a few sites.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post by Christopher »

You could save an array or object in the session that contained the text and links.
(#10850)
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Post by alex.barylski »

What your after is often refered to as a breadcrumb. Most CMS systems implement a breadcrumb however they are usually specific to the CMS, because they read from database tables.

If your web site is composed of native files and folders (even if their faked with mod_rewrite) you could write a simple JS which basically dissects the URI and turns each folder into a crumb. Output that array in the way you want and voila, you have dynamic breadcrumb navigation.
iceangel89
Forum Commoner
Posts: 39
Joined: Mon Jul 02, 2007 7:02 pm

Post by iceangel89 »

Hockey wrote:What your after is often refered to as a breadcrumb. Most CMS systems implement a breadcrumb however they are usually specific to the CMS, because they read from database tables.

If your web site is composed of native files and folders (even if their faked with mod_rewrite) you could write a simple JS which basically dissects the URI and turns each folder into a crumb. Output that array in the way you want and voila, you have dynamic breadcrumb navigation.
thats a step forward, but i guess i have a problem, if the page is named awkwardly like products_product1 for web use, in the "breadcrumb" it will be funny also.
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

iceangel89 wrote:thats a step forward, but i guess i have a problem, if the page is named awkwardly like products_product1 for web use, in the "breadcrumb" it will be funny also.
Well, that's when you either need better aliases (if it's using mod_rewrite), or database the titles and pages and such, and create the breadcrumb from that. Contrary to Hockey's suggestion, I'd do breadcrumbs in PHP, not JavaScript. I think users without JavaScript would use it more, anyway.
Post Reply