Milonic provide full featured pull down web menus for some of the worlds largest companies
click here to see what it can do for you

Download Milonic DHTML Menu
Buy Milonic DHTML Menu

Back To Start Of Archive
Taken From The Forum: Help & Support for DHTML Menu Version 5+
Forum Topic: Click to view post
Last Updated: Thursday February 8 2018 - 06:02:31

Naming convention/JS include order


Poster: toasterhead2k
Dated: Wednesday July 16 2003 - 22:53:06 BST

Let me start by stating how much I like this new version of Milonic. The named variables for each parameter are much more intuitive than counting commas, and converting into the new array file is a breeze.

I am having a bit of an issue with the new naming convention, however. My site currently has about 600 pages that include menu_array.js and mmenu.js. Version 5 seems to work fine locally when I rename the files to the old convention, but I'm not sure if this will be true in all platforms and browsers.

A second, and much more frustrating, problem I'm finding is that the script only works if the mmenu file is included before the array file in the document head. In version 3, the script worked fine if the array file was included prior to the mmenu file - this is how it's coded on the Milonic home page, and I'm sure I'm not alone in having followed this convention.

Before anyone says it -- yes I am a moron for having hard-coded this into the template instead of making the JS declarations an SSI. Stupid stupid stupid. But I'd like to see if there's any kind of workaround available for this before I begin recoding a few hundred pages.


Poster: John
Dated: Thursday July 17 2003 - 15:11:14 BST

I'm not sure renaming is a good idea with v5. Note that mmenu.js no longer exists (by that name), and is not even part of the call from your pages. All you need is milonic_src and your new array file.

Also, typically the calls are the first items in the <body>, not the <head>. I know Andy's new demos have them in the <head>, but I haven't seen anything here that specifies that change from v3.


Poster: toasterhead2k
Dated: Thursday July 17 2003 - 17:26:52 BST

You're probably right... All I'd done was rename milonic_src to mmenu and horizontal_data to menu_array. They worked fine here in IE, but I have no way of testing this in other browsers at the moment, so it's probably best not to mess with the names.

Just means that I'll have to do a gradual rollout of the upgraded menu, rather than an instantaneous switch. And this time, I'll put the script tags into an SSI, which I should've done in the first place.


Poster: John
Dated: Thursday July 17 2003 - 17:36:29 BST

Sounds good. I suspect Andy has hard-coded the main names somewhere in there (not the arrays, of course), so it's probably best not to mess with them.

FWIW, I went down the same path you did when I first started using the menu (i.e., not using an include for the calls). Now, if Andy decides to cross us up, there's only one file to mess with. :roll:

SSi call


Poster: pgrimm
Dated: Wednesday July 30 2003 - 16:48:01 BST

Can you explain how you did this for a SSI newbie?

Thanks


Poster: John
Dated: Wednesday July 30 2003 - 17:35:46 BST

There are 2 calls to get the menu up. Since these are usually right together (unless you're putting the menu in a table cell, etc.), it's easier to place the calls in a file by themselves, and then use an include to get them. At least one benefit of this is, should the boss decide to rename something, you would then have to make the change in only the one include file, instead of on every page you used hard-coded calls. Actually, any code you reuse can be handled this way - header, footer, search box, etc.

Anyway, place only the following 2 lines (no <html>, <body>, etc.) in their own file (making any name/path changes necessary for your setup)...

Code: Select all

<script language="Javascript" src="milonic_src.js" type="text/javascript"></script>
<script language="Javascript" src="xp_data.js" type="text/javascript"></script>

Name that file anything you like - let's say menu.htm (brilliant, eh?).

Now, on any page that needs the menu, do this...

Code: Select all

{beginning html, head, etc}
<body>
<!--#include file="menu.htm" -->
{the rest of your page code}

Note the format carefully - no space in <--#include..., but there is a space at .htm" -->.

When you run that page and view source you will see your 2 js lines have been pulled into the code.

This all assumes standard htm/html. The format of the include statement (but not what's in the file) is slightly different for ColdFusion, and might be for other languages as well.

Nifty.


Poster: Fire
Dated: Thursday July 31 2003 - 8:22:30 BST

And for those of you who have already hard coded the lines into each file, I recommend a small program called "Actual Search and Replace". It's a really nice full-featured multi-file search and replace program for windows. Should make it easy for you to either reorder the two lines in all your files and/or replace the two lines with a ssi.

http://www.divlocsoft.com/index.htm

peace,
fire

SSI


Poster: pgrimm
Dated: Thursday July 31 2003 - 12:13:17 BST

Thanks, great instructions!

but I have to rename all my pages with an "shtml" extension for this to work per my web host...any way around that?


Poster: Fire
Dated: Thursday July 31 2003 - 20:25:21 BST

If your ISP is running the apache web server, you should be able to solve this with an .htaccess file at the top level of your directory structure. Include the following line in the .htaccess file :

AddHandler server-parsed .html

This should make it so that files with the .html extension are parsed just like files with the .shtml extension.

If your ISP isn't running apache, then I have no idea whether this works or how else to do it.

Fire

Re: SSI


Poster: John
Dated: Thursday July 31 2003 - 22:50:06 BST

pgrimm wrote:but I have to rename all my pages with an "shtml" extension for this to work per my web host...any way around that?

Other than the message from fire, and short of a full-blown find and replace, not that I know of.

Also, per Andy, it's now OK to put the calls in either the head or the body - no longer matters which.