mm_passItemref.js -> Breadcrumbs code

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
gmester
Advanced
Advanced
Posts: 10
Joined: Tue Oct 11, 2005 9:54 pm

mm_passItemref.js -> Breadcrumbs code

Post by gmester »

I have inserted the include lines in my html code

===========================================
<script type="text/javascript" src="tools/milonic/milonic_src.js"></script>

<script type="text/javascript">
<!--
if(ns4)_d.write("<scr"+"ipt language=javascript src=tools/milonic/mmenuns4.js><\/scr"+"ipt>");
else _d.write("<scr"+"ipt language=javascript src=tools/milonic/mmenudom.js><\/scr"+"ipt>");
-->

</script>

<script language=Javascript src="tools/milonic/mm_passItemRef.js" type=text/javascript></script>
==============================================

and am using the mm_passItemref.js code downloaded from the Milonic site.

I am trying to use the breadcrumsb code listed in the mm_passItemRef() code but I keep getting the same error.

The error I get is '_m[..][1] is either null or not an object. If I edit the function and hard code a 1 into the line where '_m[1][1]' is called, then it picks up the right value. Obvously, I do not want to hard code anything, so how do I get the 'i = selectedItem;' to actually grab the selected item?

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





I
gmester
Advanced
Advanced
Posts: 10
Joined: Tue Oct 11, 2005 9:54 pm

Post by gmester »

http://support.milonic.com/demos/pass_i ... /index.htm

Here is the Milonic site for this feature.

Anyone use Breadcrumbs in this menu?
ecg921@gmail.com
Advanced
Advanced
Posts: 13
Joined: Thu Oct 13, 2005 7:34 pm

mm_passItemRef.js

Post by ecg921@gmail.com »

Where did you get mm_passItemRef.js? I can't find it on the Milonic website.

Thanks,

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

Post by Ruth »

ecg921@gmail.com, it is in the download at the bottom of the demo page from the link provided by gmester. But, note my response below to gmester.

gmester are you getting that error when you go to the demo? I'm not getting any error there. If you are not getting an error when you go to the demo, download the mm_passItemRef.js file from there. I think I'll have to check and make sure, if something was fixed, that the new .js is in the download.

Ruth
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

Hi gmester,

It sounds to me like the selectedItem variable is not getting set in the following line of the function:

Code: Select all

var selectedItem = location.search.slice(1);
mm_passItemRef.js contains two key functions:

mm_openUrl() is used to open a link from a menu item; the function is called when a menu item is clicked. The url that you want to open when the item is clicked is passed as a string to the function. The function then takes the item reference (an array index) for the clicked item and appends it to the url string before opening the new page. That way, the old page can "tell" the new page which menu item was clicked. This is necessary because once the original page is gone, so is its javascript and any variable values that were stored with the page; when the new page loads, the menu script is loaded anew, and all variables are at their default values (no clicking has yet occurred on the new page).

When the new page opens, mm_getSelectionSequence() runs (it's called at the bottom of the menu_data code). The first thing the function does is parse (using the slice method) the menu item reference out of the url string, so that it knows what menu item was clicked to get to that page. Then, it works its way back from the selected item, through the menu hierarchy, building the breadcrum text as it goes.

Whew...

The upshot is, mm_getSelectionSequence() will only work if it "knows" what item was clicked on the previous page to get to the current page. The way the demo was set up, the clicked item reference is passed from page to page using the mm_openUrl() function. Are you using that function to open your pages?

Hope that made sense,

Kevin
Post Reply