SSI and subdirectory problems

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Davidk
Super Advanced
Super Advanced
Posts: 48
Joined: Tue Sep 23, 2003 11:10 am

SSI and subdirectory problems

Post by Davidk »

Hi!

I've now decided to use SSI for my upcoming Website, but I'm having difficulties to get the menu to load when I try to open it by SSI in a file that is not in the same directory as the menu itself. You can find my very short testsite at:

http://www.davidkarlsson.se/ssi/index.shtml

All I have in what will become the root (which is not actually the root now, but in one directory) is the index.shtml file and a css file and one directory. I have saved the menu in a html file places in a directory called "includes" where I also have a file called "right" which opens up very nice in the index.shtml file, through the same SSI command as I unsuccessfully try to open the menu with (<!--#include virtual="/ssi/includes/right.html" --> and <!--#include virtual="/ssi/includes/menu.html" -->). I have not made any changes in the four menu files, not adding any '../' or '/' at all.

The message I'm receiving when the page loads is that 'ns4' is undefined. I understand that this probably has something to do with the subdirectories and I have tried to surf around the forum and try different solutions presented, but I just don't manage. please help me!

David
User avatar
fredlongworthhighschool
Mega Advanced
Mega Advanced
Posts: 362
Joined: Fri Jun 27, 2003 11:34 am
Location: Manchester, England.
Contact:

Post by fredlongworthhighschool »

I'm just starting to use SSI but until I get familliar with it, am leaving the included file in my root directory.
Andy Davis
Web Designer & Smartboard Manager

Fred Longworth High School, Manchester, England.
UEBen
Super Advanced
Super Advanced
Posts: 34
Joined: Thu Mar 27, 2003 8:26 pm
Location: Evansville, IN
Contact:

Post by UEBen »

The path to the milonic_src.js and menu_data.js files is incorrect.

You need to add "includes/" to the file path for these two javascript sources.
Davidk
Super Advanced
Super Advanced
Posts: 48
Joined: Tue Sep 23, 2003 11:10 am

Post by Davidk »

Thanks, that helps. However, if I like now have added a directory - "institute", where I have placed the file "charter.shtml" and included the same SSI-tags as in the index.shtml, it will only show the "right.html"-include and not the "menu.html"-include. This is where I run into problems, I need to be able to structure my website with directories and not keep all my files in the root. What to do???

You can now find the two files I have up there at:

http://www.davidkarlsson.se/ssi/index.shtml
- This file is now working (although it's not looking good!)

http://www.davidkarlsson.se/ssi/institute/charter.shtml
- This file only shows the "right.html"-include and not my menu, although I'm using the same commands

Please help!

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

Post by John »

OK, first things first. Your HTML is seriously screwed up, right from the start. This will just be a general outline, I'm not going to plug it all in here...

At http://www.davidkarlsson.se/ssi/index.shtml you have (roughly)...

Code: Select all

<doctype...>
<html>
<head>
</head>
<body>
<table>
<td><doctype...>
<html>
<head>
</head>
<body></body>
</html>
...
<td><doctype...>
<html>
<head>
</head>
<body>
</table>
</body>
</html></td>
...
</table>
</body>
</html>
There is some heavy-duty cleaning up that needs to be done with this code before we talk about anything else. If you don't understand let us know. We can give limited HTML help, but that is not the purpose of this Forum.

Once your code is fixed we'll work on getting rid of the numerous ../../../../../../ items, and get the includes working by using something called server-relative addressing (you can find articles on that here by doing a Search, but I'd really worry about the code first).
John
Davidk
Super Advanced
Super Advanced
Posts: 48
Joined: Tue Sep 23, 2003 11:10 am

Thanks John!

Post by Davidk »

John!

Thank you for your frankness! I think I did what is probably not uncommon for SSI-newbies, I neglected to realize that the code from the included pages will be written into the viewed page. I have now thoroughly cleaned up the code! I now believe I'm ready for the server-relative addressing. I manage to get the "right.html" included, but the menu wont appear and I of course understand it has to do with the addressing, but I can not figure out how to mend the problem. Any further assistance would be greatly appreciated!

Here's the url again:

http://www.davidkarlsson.se/ssi/index.shtml

David
UEBen
Super Advanced
Super Advanced
Posts: 34
Joined: Thu Mar 27, 2003 8:26 pm
Location: Evansville, IN
Contact:

Post by UEBen »

David,

The source path to your javascript files are incorrect. Again, you are missing: "includes/"

Also, put the javascript for the Milonic menu in the <head></head> of your index page and simply use the menu settings to position it on the page.

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

Re: Thanks John!

Post by John »

Davidk wrote:Thank you for your frankness!
Hope it didn't sound too strong, but regardless, you're welcome.
Davidk wrote:I think I did what is probably not uncommon for SSI-newbies, I neglected to realize that the code from the included pages will be written into the viewed page.
Ah, that's what you did! I was racking what's left of my brain trying to figure how all that extra stuff had gotten in there.

Just think of an include file as a snip of code, not a complete html page. Whatever you 'include' will just be sandwiched into the current page code at the location of your include statement.
Davidk wrote:I now believe I'm ready for the server-relative addressing.
Not quite yet, although I will tell you how to do it. First you really need to update your menu code, and get it licensed. You're still running RC15, with RC50 current. That's way too far back to try and shoot any other problems we may (will!) see along the way.

I have taken your code, as it stands with corrections only to the JS calls (not the menu _data code), and posted it at http://tiggr.com/ssi/. All the menu files are in /includes/. This gives us essentially the same path structure as is on your server. As you can see the menu does now display, but needs some work. The _data file also needs some minor syntax corrections. We will not work with code this old, as it would be a waste of both our time and yours as well. Update (and license)!

Note the new code for the JS calls...

Code: Select all

<script language="JavaScript" src="/ssi/includes/milonic_src.js" type="text/javascript"></script>	
<script language="JavaScript">
if(ns4)_d.write("<scr"+"ipt language=JavaScript src=/ssi/includes/mmenuns4.js><\/scr"+"ipt>");		
else _d.write("<scr"+"ipt language=JavaScript src=/ssi/includes/mmenudom.js><\/scr"+"ipt>"); 
</script>
<script language="JavaScript" src="/ssi/includes/menu_data.js" type="text/javascript"></script>
You will see I have added /ssi/includes/ to each path. This is server-relative addressing (since your server address is http://www.davidkarlsson.se/). With the coding in this form, you can now have your site go as many levels deep as you need and the calls will remain exactly the same. That won't work with the suggestion Ben posted, as he missed the leading / . His suggestion will work if your site remains at one level only.

He is correct about moving the code. Take the entire block shown above and move it to the first lines after <body>. Just leave the <td> where it is now empty. You could even place that block in an include file and call it that way if you like. Then, should something change in the calls, you only have to make the correction in one place, rather than on every page. While in some cases it is necessary to place the code in the <head> (and the menu is designed to work from either location), we find the <body> placement usually works better.

OK, your assignment is...

1. Update the code to the current version

2. Get licensed

3. Move the JS call block

4. Make the corrections to the calls
John
Davidk
Super Advanced
Super Advanced
Posts: 48
Joined: Tue Sep 23, 2003 11:10 am

Assignment completed!

Post by Davidk »

Hi again,

First of all, thanks for all the help John. I think I've completed all my assignments!

1. The code is updated to the latest version (I have followed instructions here at the Forum, and as I understand it, it is the three js-files except menu_data.js that need to be updated)
2. I'm licensed
3. I've moved the JS call block, or more correctly the include command to the first line after <body>
4. I've made the corrections to the calls.

When I display it in Netscape 7.1 is works, although the menu still looks a bit screwed up, but that I of course have to work on with my configurations. However, I still can't get the menu to apper in IE.

http://www.davidkarlsson.se/ssi/index.shtml

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

Post by Ruth »

I have IE and I can't either. I get a message, line 17 char 1 not implemented. I downloaded the page and subsituted my data.js file and it worked, so I looked at yours, and you have a top="106" no ; after it, so I fixed that, but it still didn't work, so next I just took it out since you also have that listed under the Main Menu. It worked fine in IE on my desktop when I did that. So try that and see if it works on the site.

Ruth
Davidk
Super Advanced
Super Advanced
Posts: 48
Joined: Tue Sep 23, 2003 11:10 am

Brilliant!

Post by Davidk »

Thanks alot Ruth!

I took the first top="106" without the ; and now it's working fine! Amazing how a few characters can screw thins up immensly! Now it actually seems to be working just fine, thanks everyone for your help. If it should start to mess with me again, I'll be back!

Now I just have to figure out the positioning, it works fine in IE but in Netscape it's messed up, it's a few pixels of the mark. I try to have it centered, 106 from the top and with a 2 pixel offset from the left.

http://www.davidkarlsson.se/ssi/index.shtml

Take care,

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

Post by John »

Two small things. It looks like you got most of the syntax problems in your _data, but you quit at "Africa". You have...

Code: Select all

aI("text=Overview;url=overview.html");
Should be...

Code: Select all

aI("text=Overview;url=overview.html;");
Note the additional ; after .html.

Also, 5.0 Final was released this morning. Move on up!
John
Davidk
Super Advanced
Super Advanced
Posts: 48
Joined: Tue Sep 23, 2003 11:10 am

Post by Davidk »

It seems that I'm missing the ; at several places, I'm assuming that it should be at the end of each .html in the following line before the ":

aI("text=Overview;url=overview.html;");

I guess I was a bit to quick to update :D I probably did it just before the final version was released! But, then again, it's not to hard to update it again. Any ideas on my positioning problems, or have I used up all my inquiry credits?

I really appreciate all help!

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

Post by Ruth »

Well, I use a table bound on one particular page on my site. If you have a template or since you are using ssi, I'd guess you can make a file to call in the particular place you want the main menu. Someone else would have to tell you about making that file, or if it's possible to call it like this, I don't know, but.... you'd take the Main Menu OUT! of the menu_data.js file and actually put it in the cell you have marked

Code: Select all

<TR height=23><!-- empty window for dropdown menu by way of SSI -->
    <TD colSpan=3 height=23>
coded like this...I tried it on my computer and it works in netscape, ie, firebird, opera....

Code: Select all

<TR height=23><!-- empty window for dropdown menu by way of SSI -->
    <TD colSpan=3 height=23><script language=javascript>with(milonic=new menuname("Main Menu")){
style=menuStyle;
itemwidth="100%";
position="relative";
alwaysvisible="1";
orientation="horizontal";
aI("text=Home;url=/ssi/index.shtml;status=Back To Home Page;");
aI("text=The&nbsp;Institute;showmenu=Institute;");
aI("text=Education;showmenu=Education;");
aI("text=Technical&nbsp;Cooperation;showmenu=Coop;");
aI("text=Research;showmenu=Research;");
aI("text=Publications;showmenu=Publications;");
aI("text=Seminar&nbsp;Series;showmenu=Seminar;");
aI("text=Library;url=library.html;");
}drawMenus();</script></TD></TR>
That will make sure it is always in that table cell and that it's 100% of it. The disadvantage is that you cannot set it to follow scroll...the advantage is many people dislike the menu coming down as they are trying to read. But, you could provide a small menu...made in the same data.js file that is always visible and it can follow down the left side of the page when they click it will take them back to the menu... [your margin would need to be about ?? 18 or so on that side so it wouldn't overlap your table. You'd insert another menu in the data file something like this

Code: Select all

with(milonic=new menuname("back2top")){
style=menuStyle;
top=106;
left=2;
itemwidth=18;
alwaysvisible=1;
followscroll=1;
aI("text=MENU;padding=2;url=#top;");

}


Ruth
Davidk
Super Advanced
Super Advanced
Posts: 48
Joined: Tue Sep 23, 2003 11:10 am

Post by Davidk »

Thanks again Ruth, I sure will give it a try, however, I really want to keep my follow scrolling menu. There must be some good way of getting the menu centered in both IE and Netscape. I know this is a widely debated topic and I realize that people might not want to repeat themselves, if that is the case, maybe I could just get a hint in which thread I might find a good answer.

I have my table centered and I'm using screenposition="center"; and left="offset=-2"; for the menu, which seems to put it in the middle in IE, but a few pixels of mark in Netspace. Also the top="106"; does not repond in the same way in IE and Netscape.

Sending the url again:

http://www.davidkarlsson.se/ssi/index.shtml

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

Post by Ruth »

I think the problem has to do with the built in margins the various browsers set. There was a code I used in my body tag leftMargin=0 topMargin=0 MARGINHEIGHT=0 MARGINWIDTH=0 that used to make the margins the same on netscape and ie [0]. So, you might do that in your css, then you can play with how to get the table to have that nice empty space on all sides....maybe put a surrounding one cell table with equal padding or something. Anyway, I think that's why you have the differences because the browsers have different auto margins, didn't think of that before [too simple I guess, lol].

Ruth
User avatar
fredlongworthhighschool
Mega Advanced
Mega Advanced
Posts: 362
Joined: Fri Jun 27, 2003 11:34 am
Location: Manchester, England.
Contact:

Post by fredlongworthhighschool »

The way I've gotten around includes is when I create a site there are nothing but folders in the root. The three folders which are always there are:

JS
MAIN
IMAGES

...then subsequent folders for other parts of my site, such as NEWS, ABOUT, GAMES etc. Basically a folder for the main titles on my menu

JS folder contains all the JS menu files, a CSS style sheet and a file called INC.HTM which has just the menu calls.

MAIN contains my main default page

IMAGES contains images like ARROW.GIF that the menu uses.

Every time I then create a page, all I need to add is:

Code: Select all

<link href="../js/colors.css" rel="stylesheet" type="text/css">
<!--#include file="../js/inc.htm" -->
I don't know if this is a universally accepted way of doing it, but it seems to work well for me. There is a uniformity is the ue of ../js/ on all pages.
Andy Davis
Web Designer & Smartboard Manager

Fred Longworth High School, Manchester, England.
Davidk
Super Advanced
Super Advanced
Posts: 48
Joined: Tue Sep 23, 2003 11:10 am

Post by Davidk »

Thanks again Ruth! Now it's working fine, although I set top margin to 10, but both IE, Netscape and Opera seems to accept this. Excellent! Now I just have the small problem left of getting all of this to work in older verions of browsers. I'm running IE6.0, Netscape 7.1 and the latest version of Opera. Although, according to my friend it doesn't work at all in Communicator 4.8. I saw in an older message from you Ruth that you have:

"just info...I have 4.79 so I can test my pages...milonic.com works fine But I'm on a pc, not a mac."

...as you are already involved in my project (!) would you mind having a look in your 4.79 and see what happend and perhaps also tell me what's wrong!

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

Post by Ruth »

Ok, it doesn't work in my nn4.79...but I tested it on my computer and the problem seems to be this line

Code: Select all

outfilter="randomdissolve(duration=0.3)";
If that is taken out it works. Now, I can't test it with the includes...well I could but it would take too long to find the info on how to do it again :lol: but if you take that line out of your menu_data.js file drop a note here when it's done, I'll try it again. I didn't change where the calls were on the page, so I guess they work in 4.79 even when they are in the body. Be aware though that the it definately doesn't look like it does in IE or the later browsers...The older one is static. The menu is up a bit from where it is in the others, but it's not too bad and it functions, and there aren't too many with older browsers.

Ruth
Davidk
Super Advanced
Super Advanced
Posts: 48
Joined: Tue Sep 23, 2003 11:10 am

Post by Davidk »

Thanks Ruth! I've taken the:

Code: Select all

outfilter="randomdissolve(duration=0.3)";
...away now. I have two includes on the page The right-hand window, conatining a small picture of a building among other things, is also an include, so if it appears, the include command is probably working.

The reason I'm so anxious to get it to work at least fairly well in older browsers is that our Website is directed if not primarily - at least to a large extent - to countries where the Internet revolution perhaps not has reached as far as in other countries.

David
Post Reply