Relative paths and milonic
Relative paths and milonic
I’ve just configured Milonic for use on our intranet site and am having some problems in getting the scripts to work. The scripts work fine as long as the page on which the script block is placed is in the same directory as the .js (JavaScript) files. However if try to use Milonic on a page which is in a subdirectory then all I see is a link to the milonic site.
My question is simple, what is the syntax for calling milonic from a page which is in a subdirectory?
Regards,
Neall McLaren
ICT Assistant
Yes2work Ltd.
The Acorn Centre
51 High Street
Grimethorpe
Barnsley
S 72 7BB
Website: http://www.yes2work.org.uk
Email: nmclaren@yes2work.org.uk
My question is simple, what is the syntax for calling milonic from a page which is in a subdirectory?
Regards,
Neall McLaren
ICT Assistant
Yes2work Ltd.
The Acorn Centre
51 High Street
Grimethorpe
Barnsley
S 72 7BB
Website: http://www.yes2work.org.uk
Email: nmclaren@yes2work.org.uk
Hi,
You should always use the full path to the menu files just in case you want to move into a sub directory.
You can either declare the domain name as in: http://milonic.com/milonic_src.js or remove the domain name and replace with (for example) /milonic_src.js - note that the filename is always prefeixed with a / to denote the main (root) directory.
Hope this helps,
Andy
You should always use the full path to the menu files just in case you want to move into a sub directory.
You can either declare the domain name as in: http://milonic.com/milonic_src.js or remove the domain name and replace with (for example) /milonic_src.js - note that the filename is always prefeixed with a / to denote the main (root) directory.
Hope this helps,
Andy
Hi,
Not sure I understand what you're asking, but if you mean how do you do the 'links' in the aI url section, you'd do the same as you would for an a href= but without the quotes. For example: If I didn't understand what you really wanted please post back 
Ruth
Not sure I understand what you're asking, but if you mean how do you do the 'links' in the aI url section, you'd do the same as you would for an a href= but without the quotes. For example:
Code: Select all
url=http://www.whatever.com/help/html/page.htm

Ruth
Hi,
Well, I would guess so, but I always use full paths. If you unzip all the files in the menu download and then go to the extras folder and listbased folder, for example, and open the index.htm page the code to call the menu files is
Isn't that a relative path, referring back to the main folder in which the menu program files are located? So, the index page for the listmenu is in mainFolder/extras/listbased/ and the program files are in the main folder. As you can tell paths are not my thing! It has just always been easier for me to use full path and I always know the files are found 
Ruth
Well, I would guess so, but I always use full paths. If you unzip all the files in the menu download and then go to the extras folder and listbased folder, for example, and open the index.htm page the code to call the menu files is
Code: Select all
<script type="text/javascript" src="../../milonic_src.js"></script>
<a class=milonic href="https://milonic.com/">JavaScript Menu, DHTML Menu Powered By Milonic</a>
<script type="text/javascript">
if(ns4)_d.write("<scr"+"ipt type=text/javascript src=../../mmenuns4.js><\/scr"+"ipt>");
else _d.write("<scr"+"ipt type=text/javascript src=../../mmenudom.js><\/scr"+"ipt>");
</script>
<script type="text/javascript" src="listmenus.js"></script>

Ruth
Thanks for the replay but I was actually hoping that I could use relative paths within the menu_data.js file so that all the menu item URL’s are relative to the site root - I’ve tried using ./foldername/file.htm and ../foldername/file.htm but this doesn't appear to be working on some of my pages.
In short I want to avoid hard coding the absolute path to a file in the menus as I see this as messy coding
Cheers
In short I want to avoid hard coding the absolute path to a file in the menus as I see this as messy coding

Cheers
Hi Neall,yes2work1 wrote:Thanks for the replay but I was actually hoping that I could use relative paths within the menu_data.js file so that all the menu item URL’s are relative to the site root - I’ve tried using ./foldername/file.htm and ../foldername/file.htm but this doesn't appear to be working on some of my pages.
In short I want to avoid hard coding the absolute path to a file in the menus as I see this as messy coding![]()
Cheers
Yes, you can use relative paths. But the paths you've given as examples are relative to the currently-displayed page, not relative to the site's root. E.g., let's say you're currently looking at:
Code: Select all
http://www.yourdomain.com/products/widget.htm
Code: Select all
http://www.yourdomain.com/products/foldername/file.htm
Code: Select all
http://www.yourdomain.com/foldername/file.htm
If you want to use paths relative to the site's root, then start each url with a "/" (no dots) to refer to the root directory. This would be independent of the location of the current page.
Code: Select all
aI("text=Item Text;url=/foldername/subfoldername/file.htm;");
Hope that helps,
Kevin
Relative paths and milonic
Hi Kevin,
I’ve tried what you suggested i.e. using / as opposed to ../ or ./ and this isn’t working as / takes me to the IIS Server root (this is not the same as the root directory of the website which uses the miloic menu).
I’ve tried to solve the problem by using HTML Base tags on each of the pages but this doesn’t help matters as the Base tags only work on HTML and not JavaScript.
I’ve considered reconfiguring IIS but am unsure if it is possible to change the relative path for the entire site at server level.
Any further assistance would be great, as I’m reluctant to hard-c0ode absolute URL’s into the site.
Cheers
Neall
I’ve tried what you suggested i.e. using / as opposed to ../ or ./ and this isn’t working as / takes me to the IIS Server root (this is not the same as the root directory of the website which uses the miloic menu).
I’ve tried to solve the problem by using HTML Base tags on each of the pages but this doesn’t help matters as the Base tags only work on HTML and not JavaScript.
I’ve considered reconfiguring IIS but am unsure if it is possible to change the relative path for the entire site at server level.
Any further assistance would be great, as I’m reluctant to hard-c0ode absolute URL’s into the site.
Cheers
Neall