Getting rid of SCRIPTPATH

A forum for topics relating to the Milonic Solutions Website, Milonic products, polls and anything else relating to Milonic.
User avatar
bobwill
Mega Advanced
Mega Advanced
Posts: 229
Joined: Tue Oct 01, 2002 3:03 pm
Location: Kansas
Contact:

Post by bobwill »

I still disagree on one point. My "scriptpath" variable does not have leading and closing "/". It works for me without them. My 'scriptpath' variable conatains the exact "url" of my server that I am using. that is "http://www.mysite.com/"

Also you state that this a beta version. Not so. Your statement says that you will not longer support any version except V 5.0.

Mr. "jgillet" once again evaded my question. He states "OTOH, an include is a pretty standard item in HTML coding, and its function should be known."

What do you mean it is a standard item, and what is "OTOH"??

I am sorry to be such a pain in the "A--", but you still need to explain things in terms that us "dumb A--' understand.

You need to have some one write your documentation that has no knowledge of your system so they can write in from a total netural prospective.
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

hmmm, does that mean we need to download version5 again? Sorry, I'm confused :? . All I have is what I downloaded...when it first came out... the original that tells about script path. Is there another version we need to download now with the changes in it?

Ruth
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

innkeeper9 wrote:hmmm, does that mean we need to download version5 again? Sorry, I'm confused :? . All I have is what I downloaded...when it first came out... the original that tells about script path. Is there another version we need to download now with the changes in it?
Definitely. You are way behind, Ruth. As of this message, the current v5 is...

Version 5.0 Release Candidate 11.0 Built: Monday September 22 2003 - 14:57

This item can be found towards the top of each of the 3 main code files. You do read the comments - right? :)

Note that the 'Built" item is important. The 'Release Candidate 11.0' number may or may not change with every update, therefore the date becomes your key to a new post.

I do not post a new message every time there is a minor update (just when the RC number goes up). Sometimes there's one a week, sometimes less, and sometimes, as in the last one, only 2 days between new versions.
John
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

bobwill wrote:I still disagree on one point. My "scriptpath" variable does not have leading and closing "/". It works for me without them. My 'scriptpath' variable conatains the exact "url" of my server that I am using. that is "http://www.mysite.com/"
Whatever. It's a moot point, anyway, since scriptpath is no longer a part of the system.
bobwill wrote:Also you state that this a beta version. Not so.
Excuse me? I didn't realize you were part of the development team. You do realize that RC stands for "Release Candidate", which is NOT a final version. Granted, it's a step up from beta, but still, as I said, subject to changes and updates.
bobwill wrote:Your statement says that you will not longer support any version except V 5.0.
Correct. What's your point?
bobwill wrote:Mr. "jgillet" once again evaded my question. He states "OTOH, an include is a pretty standard item in HTML coding, and its function should be known."

What do you mean it is a standard item, and what is "OTOH"??
I mean just what I said - an include is a command used by programmers at all levels to keep from re-writing frequently used pieces of code.

As for "OTOH", about as easy as an Emoticon - "On The Other Hand", which has nothing whatsoever to do with HTML or coding.
bobwill wrote:You need to have some one write your documentation that has no knowledge of your system so they can write in from a total netural prospective.
As a former magazine editor, I believe Andy has done an excellent job of writing the docs. They are, as is the menu, still in beta (rough draft), but I don't see any major changes coming along for them.

As for, "...have some one write your documentation that has no knowledge of your system...", how could that be possible? If you were asked to write a maintenance manual for a Boeing 777, and had absolutely no knowledge of that aircraft at all, could you do it?

A certain level of computer and HTML knowledge has to be assumed for this system. It is basically easy, but not for the absolute rank beginner. We try to answer all questions as clearly as possible, again with the assumption of basic understanding, and without 'talking down' to anybody.
John
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

I feel the need to say something here. First of all you are coming across quite rude and seem to be taking things personally for no apparent reason. Everyone here has been nothing but helpful and have never declined to help someone or even explain things 8 times with ever greater detail.

As John said twice, this menu is two things. One, its still in RC, so it is NOT final. Technically it doesnt really NEED to even be published to everyone, rather, it could be released to a select few and milonic only support them. But instead, they wanted it out there so people could begin experimenting, implementing, and getting to know the new code. Secondly, this menu is done in javascript and HTML. You need to know practically nothing about HTML (3 lines of <SCRIPT>) and you need to know some of the basics of javascript. If you dont know javascript, take it upon yourself to learn alittle about it and its terminology so you can follow things alittle better. We don't exactly talk that advanced on this forum, BELIEVE ME we don't. And we're also not here to give you a course in javascript either. Taking it out on the creators of the menu for your lack of programming experience on a product that is still in development is pretty short sighted, IMHO (in my humble opinion).

So all that aside, you are having problems...fine. Ask the questions and we will answer them, every time. The menu is still changing so if you don't like it, wait until it IS final and there IS final documentation. Considering what all the creators of this menu are doing and still managing to get some docs out there is pretty good.

But come across the way you have been, and don't expect to get much in return. I don't like helping people that refuse to help themselves.
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
User avatar
bobwill
Mega Advanced
Mega Advanced
Posts: 229
Joined: Tue Oct 01, 2002 3:03 pm
Location: Kansas
Contact:

Post by bobwill »

OK, I apoligize for my attitude. I do like the menu and I have been trying to learn more about javascripts. So with that being said here is my question. I had the "Scriptpath" variable set to "http://www.myserver.com/". Inside of each "htm" file I had the following code:

SCRIPT language=JavaScript src="javascripts/milonic_src.js" type=text/javascript></SCRIPT>
<SCRIPT language=JavaScript src="javascripts/menu_data.js" type=text/javascript></SCRIPT>

With the new code where do I add the path? I want the path to be a variable rather than hard code.

<SCRIPT language=JavaScript src="javascripts/milonic_src.js" type=text/javascript></SCRIPT>
<script language=JavaScript>
if(ns4)_d.write("<scr"+"ipt language=JavaScript src=javascripts/mmenuns4.js><\/scr"+"ipt>");
else _d.write("<scr"+"ipt language=JavaScript src=javascripts/mmenudom.js><\/scr"+"ipt>");
</script>


Once again, thanks for your fine support.
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

bobwill wrote:OK, I apoligize for my attitude.
Accepted, Sir, and thank you. Dave and I really do try to keep things on a level everybody can understand, without 'talking down' or 'talking above' anybody. It can be, to put it mildly, tough :!: :D
bobwill wrote:I do like the menu and I have been trying to learn more about javascripts. So with that being said here is my question. I had the "Scriptpath" variable set to "http://www.myserver.com/". Inside of each "htm" file I had the following code:

SCRIPT language=JavaScript src="javascripts/milonic_src.js" type=text/javascript></SCRIPT>
<SCRIPT language=JavaScript src="javascripts/menu_data.js" type=text/javascript></SCRIPT>
Your 2 calls above indicate you have your menu scripts in a directory called /javascripts/. That being the case, scriptpath would be simply...

Code: Select all

scriptpath="/javascripts/";
This is server-relative addressing - where the directory is relative to the server address. Your server is http://www.myserver.com/, and your structure in the calls says the menu stuff is in /javascripts/, so the relative path is /javascripts/.
bobwill wrote:With the new code where do I add the path? I want the path to be a variable rather than hard code.
Do you mean the path to your menu data file? Typically that would be placed directly after the calls, but it depends on how you are setting up your menu and page structure.

But first, you have...

Code: Select all

<SCRIPT language=JavaScript src="javascripts/milonic_src.js" type=text/javascript></SCRIPT>	
<script	language=JavaScript>
if(ns4)_d.write("<scr"+"ipt language=JavaScript src=javascripts/mmenuns4.js><\/scr"+"ipt>");		
  else _d.write("<scr"+"ipt language=JavaScript src=javascripts/mmenudom.js><\/scr"+"ipt>"); 
</script>
I would change that to the following...

Code: Select all

<script language=JavaScript>
if(ns4)_d.write("<scr"+"ipt language=JavaScript src=/javascripts/mmenuns4.js><\/scr"+"ipt>");		
  else _d.write("<scr"+"ipt language=JavaScript src=/javascripts/mmenudom.js><\/scr"+"ipt>"); 
</script>
<script language=JavaScript src="/javascripts/menu_data.js" type=text/javascript></script>
Note the addition of a / before 'javascripts', and also the menu data call at the end (yours may be named differently, and/or, again, need to be in a different place depending on how you're setting up your page).

The / in front of 'javascripts' makes these calls server-relative, as above. This means, regardless of how many levels deep your site may get, the very same calls will still work; i.e., you won't have to re-write the calls with ../javascripts, or ../../javascripts, etc., for different pages.

As for includes, it's a shortcut for code that is reused. In this case...

Code: Select all

<script language=JavaScript>
if(ns4)_d.write("<scr"+"ipt language=JavaScript src=/javascripts/mmenuns4.js><\/scr"+"ipt>");		
  else _d.write("<scr"+"ipt language=JavaScript src=/javascripts/mmenudom.js><\/scr"+"ipt>"); 
</script>
<script language=JavaScript src="/javascripts/menu_data.js" type=text/javascript></script>
...could be put on a page all by itself (no <html>, <body>, or any other HTML coding), and saved as, say menucall.htm. Then, anyplace in your page that you would normally put all those lines, put instead...

Code: Select all

<!--#include file="menucall.htm" -->
That 1 line will go get the file with all the Javascript code and automatically insert it in your page. The real benefit here is if something should change in the Javascript calls you need to make the change only in that 1 file, not on every page in your site.

Hope this helps. Post a URL we can look at when you get things up and we'll go from there (assuming you still need help at that point!).
bobwill wrote:Once again, thanks for your fine support.
You are welcome.
John
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

Thank you bobwill, we would be glad to help you in every way, not matter what it takes.

John, I would just like to catch something you mention that I think is incorrect. The Include you are referring to, John, is what is used in pages that utilize ASP (Active Server Pages); they are pages that end with .asp. Basically what this means is, the server that the pages are coming from must be able to serve up .asp pages and only then can you use the <!--#include file = "" --> directive. Such servers most likely are running Microsoft's Internet Information Services. It seems bobwill is using pages with .htm on them, which means the server is not going to parse up the page beforehand and throw in whatever the include directive is referring to. With HTML files, there is no real easy way to include other files...and especially in this case where you really arent including other htm files, but js files. If his server supports it, he could change all his page names to .asp and then it may work.

So basically you are probably going to have to put in those couple lines of <SCRIPT src='...'></SCRIPT> includes that John said, into each page. These types of includes are 'javascript includes' that are done in the HTML and the actual js code is brought into the page once it gets down to the browser.

Now regarding the paths to your files. When John said your path should be /javascripts/ that means that the javascript directory should probably be in the root of your site. What this means is basically you should be able to get to your menu files by typing into your browser's address bar..."http://www.yourdomain.com/javascripts/milonic_src.js". If you CAN do this, and you are keeping ALL of your menu source files in that javascripts directory, you can then access those files from anywhere on your site using the path /javascripts/menuFilename.js. Therefore, the code that john gave you would do that and you would just paste that code into every .htm page. Then if any changes occur to the milonic_src, mmenudom, or your menu_data files, you can just change them in the one spot and all .htm files are looking at the same files. The / in front of the javascripts directory essentially says "start at http://www.yourdomain.com and then look for a directory called javascripts inside of it, and work from there". Get it?

I would recommend looking into your server supporting ASP. Because if it is, you then easily change the names of your pages (and links) to end with .asp and then you can just create one file which holds the lines of code to do the includes and include it into all your files (thats what I do). You dont have to change any html or anything inside of a .htm file for it to successfully by a .asp file. It just gives you the ability to do more in the page before the user gets it. But if you would rather stick to your guns with the htm files, thats fine, just follow our guidelines. The scriptpath is pretty much gone for good so you SHOULD be ok with the way we are including all the menu files, it SHOULDNT change. But as always, take it with a grain of salt because it COULD in the future.

Hope you got everything. If not, let us know!! :D
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

Hergio wrote:John, I would just like to catch something you mention that I think is incorrect. The Include you are referring to, John, is what is used in pages that utilize ASP (Active Server Pages); they are pages that end with .asp.
Gotcha, oh great JS man from the east!

Using that exact format here on IIS servers with .htm pages, not to mention I use it on my personal site with Apache and .html. Granted, some setups may require .shtm or .shtml if the option is not set.

That's one for Arizona :!: :D
John
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

Hey wait, you mean to say you got <!--#include file = "filename.html" --> to work in an html file? I did it here with IIS 5.0 on a Win2000 server and got nothing but a commented line in the output file.

Do you have your IIS setup so that you parse both asp and htm(l) files using the same ISAPI dll's?
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

Absotively :!:

I didn't set up the server, but I know they (IT) suddenly decided one day that it would improve performance if they didn't parse for SSI in non-shtm files. That would have meant 400+ pages I needed to change, and well over 1,000 links. Not happenin'. They turned the parse back on.
John
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

Then take that point back! :lol: You're in a very unique case...bobwill might not be able to do that ya know! Man, you had me goin. I thought everything I knew was bogus! :lol:
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
User avatar
bobwill
Mega Advanced
Mega Advanced
Posts: 229
Joined: Tue Oct 01, 2002 3:03 pm
Location: Kansas
Contact:

Post by bobwill »

I finally got an answer about my server support and "ASP" is not supported. I did get the calls "server-relative" to work with the "/" being the root directory. I still have one thing that I want cleared up. I understand that a line of code such as "<SCRIPT language=JavaScript src="/javascripts/milonic_src.js" type=text/javascript></SCRIPT>" is what you refer to as a "Javascript Include".
Can this type of "include" address a "js" file that contains all of the following, thus only having one line of code to add to each "htm' file??

<SCRIPT language=JavaScript src="/javascripts/milonic_src.js" type=text/javascript></SCRIPT>
<script language=JavaScript>
if(ns4)_d.write("<scr"+"ipt language=JavaScript src=/javascripts/mmenuns4.js><\/scr"+"ipt>");
else _d.write("<scr"+"ipt language=JavaScript src=/javascripts/mmenudom.js><\/scr"+"ipt>");
</script>
<SCRIPT language=JavaScript src="/javascripts/relative_data.js" type=text/javascript></SCRIPT
User avatar
John
 Team
 Team
Posts: 5967
Joined: Sun May 19, 2002 8:23 pm
Location: Phoenix, AZ
Contact:

Post by John »

bobwill wrote:I understand that a line of code such as "<SCRIPT language=JavaScript src="/javascripts/milonic_src.js" type=text/javascript></SCRIPT>" is what you refer to as a "Javascript Include".
Semantics, I guess, but to me it's a call to a javascript file, not technically an include (which is 'usually' a file with HTML). Yes, they perform the same function (get some code and add it to the page), but I'm being picky only because the syntax is entirely different for each.
bobwill wrote:Can this type of "include" address a "js" file that contains all of the following, thus only having one line of code to add to each "htm' file??

<SCRIPT language=JavaScript src="/javascripts/milonic_src.js" type=text/javascript></SCRIPT>
<script language=JavaScript>
if(ns4)_d.write("<scr"+"ipt language=JavaScript src=/javascripts/mmenuns4.js><\/scr"+"ipt>");
else _d.write("<scr"+"ipt language=JavaScript src=/javascripts/mmenudom.js><\/scr"+"ipt>");
</script>
<SCRIPT language=JavaScript src="/javascripts/relative_data.js" type=text/javascript></SCRIPT
Short answer is yes, if your server understands includes.

Put...

Code: Select all

<SCRIPT language=JavaScript src="/javascripts/milonic_src.js" type=text/javascript></SCRIPT>
  <script	language=JavaScript>
if(ns4)_d.write("<scr"+"ipt language=JavaScript src=/javascripts/mmenuns4.js><\/scr"+"ipt>");		
  else _d.write("<scr"+"ipt language=JavaScript src=/javascripts/mmenudom.js><\/scr"+"ipt>"); 
</script>
  <SCRIPT language=JavaScript src="/javascripts/relative_data.js" type=text/javascript></SCRIPT
...in a file by itself - no doctype, <header>, <body>, etc. Save it as, say, menucall.htm.

In your HTML, add the following line where you want the call to the JS to be 'included'...

Code: Select all

<!--#include file="menucall.htm" -->
Note the syntax carefully - NO space at the front end, but there is a space between htm" and -->. Also note the exact syntax may be different on your server, AND it may be necessary to change your file suffix to .shtm or .shtml. Again it depends on your server/host.
Last edited by John on Tue Sep 30, 2003 6:33 pm, edited 2 times in total.
John
User avatar
bobwill
Mega Advanced
Mega Advanced
Posts: 229
Joined: Tue Oct 01, 2002 3:03 pm
Location: Kansas
Contact:

Post by bobwill »

Never mind, I think I got it figured out. I created a "js" file with each line of the required code and that code was generated using the "document.write" statement. So I ended up with a "js" file that contains: Seems to work.

document.write('<SCRIPT language=JavaScript src="/javascripts/milonic_src.js" type=text/javascript></SCRIPT>');
document.write('<script language=JavaScript>');
document.write('if(ns4)_d.write("<scr"+"ipt language=JavaScript src=/javascripts/mmenuns4.js><\/scr"+"ipt>"); ');
document.write(' else _d.write("<scr"+"ipt language=JavaScript src=/javascripts/mmenudom.js><\/scr"+"ipt>"); ');
document.write('</script>');
document.write('<SCRIPT language=JavaScript src="/javascripts/relative_data.js" type=text/javascript></SCRIPT>');
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

Nice job bob, I actually tried that previously and I couldn't get it to work perfectly. Got little errors here and there. I kinda gave up on it, thinking there was no easy way to include js files using other js files. But nice work, glad you figured that out. See, you're already on your way to being an expert! ;)
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
User avatar
bobwill
Mega Advanced
Mega Advanced
Posts: 229
Joined: Tue Oct 01, 2002 3:03 pm
Location: Kansas
Contact:

Post by bobwill »

I did find out one more thing about the server that I am using. The system adminstrator told me that they support "PHP" type files.
Do you know what the syntax is for doing an "INCLUDE" using "PHP"??
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

This is regular php include syntax. But I am unsure how you would do the path structure if your menus were located somewhere back down in the root. I know you could use ../dir1/dir2/menu.js but I dont think the server relative addressing works in this case, like the /dir1/dir2/menu.js I dont think would work.

Code: Select all

<?php
include("header.php");
include("top.php");
include("side.php");
include("body.php");
include("footer.php");
?>
There is also an require statement you can use too. Check out http://www.phpbuilder.com/manual/function.include.php for more info. To get things to reference from the document root, there is a predefined PHP variable that allows you to do this.

Code: Select all

<?php
include("$DOCUMENT_ROOT/includes/file.inc"; 
?>
Hope this helps.
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
Locked