I have this code currently (I'm not a hardcore coder):
Currently it echos the directory a file is in while stripping out dashes in the file directory name. Works great for me.Code:<?php // Rename Directory to name $dir = basename(dirname(__FILE__)); echo ucwords(str_replace('-', ' ', $dir)); ?>
What I am trying to do is use PHP code to create a back link so when the link is clicked, the user will go to the next directory up in the hierarchy.
For example: I'm in Home > automotive > motorcycle-and-atv > protective-gear so I'm in the protective gear section of the site.
I want to make a link that says something like:
Back to {Directory one level up}
In this case it would be:
Back to Motorcyle And ATV
When clicked, it goes to the directory one level up (which I have an index.php page in every directory so it would technically go to the index.php page).
Any help would be very much appreciated.



Reply With Quote
Bookmarks