Error in breadcrumbs demo _mi[i] is undefined

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
raemacleman
Beginner
Beginner
Posts: 8
Joined: Tue Jul 25, 2006 11:57 am

Error in breadcrumbs demo _mi[i] is undefined

Post by raemacleman »

Hi,

My aim is to build in the text breadcrumbs functionality as outlined in the mm_passItemRef demo in your support area. Trying the demo with Firefox 3 yields an error (and no breadcrumbs) - "_mi is undefined" and the line it highlights is ...

function mm_getSelectionSequence()
{
var selectedItem = location.search.slice(1);
var i = selectedItem;
do {
if (mm_selectionSequence == "")
mm_selectionSequence = _mi[1]; <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
else
mm_selectionSequence = _mi[1] + mm_separator + mm_selectionSequence;
i = getParentItemByItem(i);
} while (!isNaN(i));
}

I've followed the 'recipe' exactly, locally, and get (a) no breadcrumbs and (b) the same error.
Can anyone help, please? I have a deadline looming and if I can't get this working it'll take all week to code by hand!
Kind regards
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Re: Error in breadcrumbs demo _mi[i] is undefined

Post by Ruth »

Hi,

I think I fixed it. At least it seems to work in IE6, NN7.2, 9.0.0.5, FF1.5, 2.0.0.18, 3.0.1

It seems that for this and also the similar 'breadcrumbs' function demo, it is necessary to add a clickfunction to the aI, so the following

Code: Select all

aI("text=Test 1;showmenu=Test1;url=javascript:mm_openUrl('index.htm');");
needs to be changed to
EDIT 8:38pm 12/03: Sorry I made a mistake which I have now corrected in the following code

Code: Select all

aI("text=Test 1;showmenu=Test1;url=javascript:mm_openUrl('index.htm');clickfunction mm_getSelectionSequence();");
I have not yet updated the directions page, but wanted to post and give you the info on how to do it. I don't do functions or js, so though it works, I'm still getting the mi has no properties, or is undefined. I am going to post and ask Milonic about this. But whatever it is, it is not interferring with the operation of the function as far as I can tell, just giving the error message.

Hope this helps

Ruth
raemacleman
Beginner
Beginner
Posts: 8
Joined: Tue Jul 25, 2006 11:57 am

Re: Error in breadcrumbs demo _mi[i] is undefined

Post by raemacleman »

Ruth,

Thank you for this, but it doesn't actually work either. One variation of your syntax which works for me is this...

Code: Select all

url=javascript:mm_openUrl('/photo-album.html');clickfunction=mm_getSelectionSequence();");
... and now it works!

However, it doesn't actually write links (my interpretation of 'breadcrumbs' is that you can click on the breadcrumb link to move back to that page rather than going through the menu). Is there some function or similar tool which will write breadcrumb LINKS? i.e.

Code: Select all

<a href="top.html">Top Level</a> >> <a href="second.html">Second Level</a>
rather than

Top Level >> Second Level

Kind regards
--
raemacleman
Beginner
Beginner
Posts: 8
Joined: Tue Jul 25, 2006 11:57 am

Re: Error in breadcrumbs demo _mi[i] is undefined

Post by raemacleman »

Sorry,

For some reason I read your earlier version before it was amended. On looking again the code sample had been refreshed.

Kind regards
Rae MacLeman
--
raemacleman
Beginner
Beginner
Posts: 8
Joined: Tue Jul 25, 2006 11:57 am

Re: Error in breadcrumbs demo _mi[i] is undefined

Post by raemacleman »

Ruth,

Having thought about this for a bit, it appears that I could write out breadcrumb links by taking the string returned in mm_selectionSequence, splitting it, then getting the url for each menu item text and then re-writing the string with the urls added.

Are there functions which would allow me to recover the url from the item text?

Kind regards
Rae MacLeman
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Re: Error in breadcrumbs demo _mi[i] is undefined

Post by Ruth »

Hi Rae,

:lol: I have not a clue. I really don't know anything about functions or creating them. Usually when I figure out a fix it's only because I just tried this, that and the other and luckily something clicked. But, I would guess there are such things since we have those functions that Kevin wrote that appear on the demos page. I have posted to Milonic to ask them about it, and there is the following information which may help you.

There is also a page with 'methods and functions' that might give you some info

http://milonic.com/menu_methods.php

And, I remember a post by Kevin a very long time ago something about dynamically changing urls and he did a very detailed explantion of item reference # for each part of an item, so maybe that will help you, also

viewtopic.php?p=14348

Hope something here is helpful.

EDIT: and i will see if I can figure out how to have the breadcrumb be a link, that would be great

Ruth
Post Reply