[Javascript] Dynamic breadcrumbs script
Paul Novitski
paul at novitskisoftware.com
Tue Aug 24 12:10:24 CDT 2004
Kevin,
I figured out what you meant by the possessive pronoun "your" in your
posting: you were thinking that a script you found in the LaTech JavaScript
archives is the collective child of the current listserve
membership. Instead, this listserve is a loose collection of individuals
each contributing their own bits to the collective soup. Any script
contributed by a listserve member is the intellectual child of that member,
and may not be known to or understood by other members. Not a critical
distinction, but one worth noting for future reference.
I suspect that the script you're referring to is the dynamic breadcrumbs
script written by Harry Love, as described in
https://lists.latech.edu/pipermail/javascript/2002-August/004019.html
His script is located at
<http://healthlinks.washington.edu/scripts/dynacrumbs.js>http<http://healthlinks.washington.edu/scripts/dynacrumbs.js>://healthlinks.washington.edu/scripts/dynacrumbs.js
Quickly perusing Harry's script, I see that it creates breadcrumb links in
the format
Base > node > node > node
from the current page's URL.
In a quick test, I didn't see the final node (the html file itself)
included in the breadcrumb array, regardless of its file name (index.html
or dynacrumbs.html). It seems clear that Harry was deliberately omitting
that node.
The final for/next loop of the script begins this way (where urlL is the
number of nodes in the URL):
if(urlL>2)
{
for(x=startPoint+1;x<urlL;x++)
{
if(x<urlL-1)
In other words, that last if-test is excluding the final node of the
array. If you change that last line to:
if(x<urlL)
then your html file name will be displayed. You might wish to tweak the
display by deleting the file extension, etc.
Good luck,
Paul
At 07:18 AM 8/24/2004, Atkins, Kevin D wrote:
>Paul,
>
>Thanks for the reply. The script I found and am trying to use comes from
>your site called Dynamic Breadcrumbs, I am attaching the code I am
>using. I can also send a few test pages to see how I have added in the
>javascript code to call the external breadcrumb file.
>
>You can't view any of the files on my site because it is a secured
>Intranet site that only employees are allowed to login into and view. I
>am hoping you don't need to view the actual pages on my site to help me
>modify the script?
>
>I will try to describe my site and file structure in case this can help
>to understand the layout and how I think the code is acting. I share a
>server instance with another department, we both have a separate virtual
>server to store our files. An example of my area is
>www.something.com/fop at this level is my index.html page.
>
>I changed the var startname in the breadcrumb script to Home. When the
>breadcrumb code runs it rights out Home > correctly on my index.html
>page. The url assigned is www.something.com/fop, it does not show
>index.html in the url link as the page to load. Clicking the Home
>breadcrumb reloads the index.html page, leading me to think the
>breadcrumb code thinks every breadcrumb link will have an index.html
>file in the folders or directories.
>
>I created 2 test links on my test index page, the folder structure is
>/fop/page1 and /fop/page1/page2. When Test page 1 is selected on the
>index.html page the breadcrumb gets written ok as Home > Page1 > Test
>Page 1. The breadcrumb url link for Test page1 is written as
>www.something.com/fop/page1/. If you click the Page1 breadcrumb url it
>does not reload test page1 called test-page1.html. Instead it displays a
>file list of all files in the page1 folder. I think because it does not
>see an index.html page in the page1 folder.
>
>What I am trying to get is the breadcrumb url to be written as
>www.something.com/fop/page1/test-page1.html. The same thing happens for
>test page 2. Is there a way for the breadcrumbs.js file to actually read
>the url of the page you are on and write that into the breadcrumb url
>link and not assume it is index.html?
>
>I am sorry if my explanation doesn't make sense, I hope it does? If you
>can't help because you can't see the files in actual use, that's ok, I
>will just have to look for another script somewhere. Thanks for your
>time.
>
>Kevin Atkins
>Sr. Analyst Flight Operations
>612-727-6732
More information about the Javascript
mailing list