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.
PHP Site Map Path
Moderator: General Moderators
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
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.
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
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.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.
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
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.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.