Closed Thread Icon

Topic awaiting preservation: PHP Bread Crumbs Pages that link to <a href="https://ozoneasylum.com/backlink?for=12747" title="Pages that link to Topic awaiting preservation: PHP Bread Crumbs" rel="nofollow" >Topic awaiting preservation: PHP Bread Crumbs\

 
Author Thread
smonkey
Paranoid (IV) Inmate

From: Northumberland, England
Insane since: Apr 2003

posted posted 05-17-2003 17:12

I have searched this forum and seen a few interesting things, most notably some links to other php scripts that perform the bread crumb creation process. These scripts are a bit confusing to me and seem to do things I don't need (like renaming folder titles to something else etc.)

I have a JavaScript that creates breadcrumbs and I have it customised to work the way I like it, except that it is JavaScript and not PHP. Would anybody be able to translate this script into PHP for me or have any links for good PHP breadcrumbs that aren't either the zend tute or the 'breadcrumbs for php lovers' page.

code:
<script language="javascript">
function buildDepth(iterations)
{
var iterations=iterations-3;
var depthStr="";
for (i=0;i<iterations;i++)
{
depthStr=depthStr + "../";
}
return depthStr;
}
function bctrail()
{
var constituentFolders = new Array();
var currentURL = document.location.toString();
constituentFolders=currentURL.split("/");
var outputStr="";
for (count=2;count<(constituentFolders.length-1);count++)
{
outputStr=(outputStr + "<a href='" + buildDepth((constituentFolders.length-count)+1) + "index.htm'>" + constituentFolders[count] + "</a> > ").replace("_"," ");
}
document.write(outputStr.slice(0,outputStr.length-2));
}
</script>

The only problems with this script is the last breadcrumb is a link even tho it doesn't need to be, plus a little more flexibility with the directory default page would be nice (most of my directories have a default page of index.htm, but some may not in some instances so basically i'd like it use index.htm/php/html if it exists, but if not then to use whatever tht htaccess file states (presumably this would be accomplished by completely removing the filename so it only calls the directory) - alternatively this filename could just be removed all together as my htaccess dictates the index.htm/php/html stuff already (does anyone see any problems with doing that?)

visit my CryoKinesis Online Gallery

Emperor
Maniac (V) Mad Scientist with Finglongers

From: Cell 53, East Wing
Insane since: Jul 2001

posted posted 05-17-2003 18:00

smonkey: All my breadcrumb resources are here:
http://development.gurusnetwork.com/links/544/

but on the PHP front I think you have seen the main resources that I'm aware of. That script looks fine and there should be no problem changing it to PHP. Let us know how you get on.

[edit: I should add that I like breadcrumbs and use them a lot but each script to generate tham is different depending on the code but esp. on the URL that is being generated]

___________________
Emps

FAQs: Emperor

« BackwardsOnwards »

Show Forum Drop Down Menu