Page 1 of 1
PHP Site Map Path
Posted: Mon Jul 02, 2007 7:05 pm
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.
Posted: Mon Jul 02, 2007 7:43 pm
by Christopher
You could save an array or object in the session that contained the text and links.
Posted: Mon Jul 02, 2007 8:19 pm
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.
Posted: Tue Jul 03, 2007 1:48 am
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.
Posted: Tue Jul 03, 2007 6:17 am
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.