/    Sign up×
Community /Pin to ProfileBookmark

Breadcrumb Subfolder Problem. HELP!!!

Hi,

I am using a free breadcrumb script on a site that i am working on for my new business (i am only a hobbyist web designer). I did not write the script and I am not proficient in javascript. I was wondering if someone could help me fix the script.

The problem I am having is this:

When you navigate the site, anywhere other than index.html, you are into a system of subfolders.
[INDENT][I]
e.g. Page entitled Resources is located at ([url]http://www.fuselearning.co.uk/resources/resourcesmain.html)[/url][/I]
[/INDENT]

The breadcrumbs appear fine, exactly where i want them to, but when you click the breadcrumb (anything other than home) you are taken to a list of folders. The basic reason for this is that the URL it tries to take you to does not represent the subfolder structure.

[INDENT][I]You are in Library (located at [url]http://www.fuselearning.co.uk/resources/Library/FuseLibrary.html[/url]) are you click the resources breadcrumb to return to the Resources page on level up. Instead of taking you to the correct URL ([url]http://www.fuselearning.co.uk/resources/resourcesmain.html[/url]) it takes you to [url]http://www.fuselearning.co.uk/resources[/url] [/I][/INDENT]. This is just the folder, not the actual page, so the browser displays the contents of the folder. It has me tearing my hair out!!!:mad:

To see the problem in action click here [url]http://www.fuselearning.co.uk/resources/Library/FuseLibrary.html[/url]
and then click on the Resources breadcrumb.

I have no idea what in the script is making it do this or how to fix it. I am hoping it is fairly simple. Can anyone help me out. I would be eternally grateful.?

Here is the script

[code]var crumbsep = ” > “;
var precrumb = “<span class=”crumb”>”;
var postcrumb = “</span>”;
var sectionsep = “/”;
var rootpath = “/”; // Use “/” for root of domain.
var rootname = “Home”;

var ucfirst = 1; // if set to 1, makes “directory” default to “Directory”

var objurl = new Object;
objurl[‘softskills’] = ‘Soft Skills’;
objurl[‘ittraining’] = ‘IT Training’;
objurl[‘profskills’] = ‘Professional Skills’;
objurl[‘method’] = ‘Methodology’;
objurl[‘events’] = ‘Events’;
objurl[‘consult’] = ‘Consultancy’;
objurl[‘casestudies’] = ‘Case Studies’;
objurl[‘whoweare’] = ‘Who We Are’;
objurl[‘whatwedo’] = ‘What We Do’;
objurl[‘contactus’] = ‘Contact Us’;
objurl[‘resources’] = ‘Resources’;
objurl[‘library’] = ‘Library’;

// Grab the page’s url and break it up into directory pieces
var pageurl = (new String(document.location));
var protocol = pageurl.substring(0, pageurl.indexOf(“//”) + 2);
pageurl = pageurl.replace(protocol, “”); // remove protocol from pageurl
var rooturl = pageurl.substring(0, pageurl.indexOf(rootpath) + rootpath.length); // find rooturl
if (rooturl.charAt(rooturl.length – 1) == “/”) //remove trailing slash
{
rooturl = rooturl.substring(0, rooturl.length – 1);
}
pageurl = pageurl.replace(rooturl, “”); // remove rooturl fro pageurl
if (pageurl.charAt(0) == ‘/’) // remove beginning slash
{
pageurl = pageurl.substring(1, pageurl.length);
}

var page_ar = pageurl.split(sectionsep);
var currenturl = protocol + rooturl;
var allbread = precrumb + “<a href=”” + currenturl + “”>” + rootname + “</a>” + postcrumb; // start with root

for (i=0; i < page_ar.length-1; i++)
{
var displayname = “”;
currenturl += “/” + page_ar[i];
if (objurl[page_ar[i]])
{
displayname = objurl[page_ar[i]];
}
else
{
if (ucfirst == 1)
{
displayname = page_ar[i].charAt(0).toUpperCase() + page_ar[i].substring(1);
}
else
{
displayname = page_ar[i];
}
}
allbread += crumbsep + precrumb + “<a href=”” + currenturl + “”>” + displayname + “</a>” + postcrumb;
}
document.write(allbread);[/code]

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@konithomimoJan 24.2007 — Usually you put an index file page in each folder, which displays tha main page of the folder (directory). Otherwise you have to make the link go to a specific page.
Copy linkTweet thisAlerts:
@konithomimoJan 24.2007 — As a sidenote, the index apge can be used to display the main content, redirect to the page you want to use as your main page, or display an error saying that the folder cannot be directly accessed.
Copy linkTweet thisAlerts:
@flunkieauthorJan 24.2007 — that has sorted it. I knew it would be something simple but really irritating and I was right. Thanks for your help. ? ? ? ? ? ?
Copy linkTweet thisAlerts:
@konithomimoJan 24.2007 — no problem
×

Success!

Help @flunkie spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...