st0rmer Posted October 26, 2007 Share Posted October 26, 2007 I have a site, and i want to be able to show the location using PHP For example, if i am at mysite.com/section1/contact.html It might show something like Home >> Section 1 >> Contact Is there a way to do this? Thanks Quote Link to comment https://forums.phpfreaks.com/topic/74940-breadcrumbs/ Share on other sites More sharing options...
The Little Guy Posted October 26, 2007 Share Posted October 26, 2007 $url = 'mysite.com/section1/contact.html'; list($site,$dir1,$file) = explode('/',$url); echo "Home >> $dir1 >> $file"; Quote Link to comment https://forums.phpfreaks.com/topic/74940-breadcrumbs/#findComment-378937 Share on other sites More sharing options...
dbo Posted October 27, 2007 Share Posted October 27, 2007 The way microsoft implements this for the .NET framework is via an XML file. You specify the relationships amongst tables in an XML file and then hook it up to a breadcrumb control. Okay, now that I've said that... there's not a feature like this in PHP, but I think this approach or a similar one might make for an easy and consistent implementation. The above approach isn't necessarily a bad one but it relies heavily on a naming convention and assumes that you structure your files in a directory structure which is not always the case... you may store them in a database for example. Quote Link to comment https://forums.phpfreaks.com/topic/74940-breadcrumbs/#findComment-379074 Share on other sites More sharing options...
st0rmer Posted October 27, 2007 Author Share Posted October 27, 2007 I'' try little guys method What if i needed more than one word for the name of the section. If i used a '-' is the directory, could i make the dash mean a space? Quote Link to comment https://forums.phpfreaks.com/topic/74940-breadcrumbs/#findComment-379169 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.