Milonic site and Netscape and a little PHP maybe

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
pavia
Super Advanced
Super Advanced
Posts: 39
Joined: Fri Aug 16, 2002 2:39 pm

Milonic site and Netscape and a little PHP maybe

Post by pavia »

Netscape 4.7X sucks but I don't have a choice--I still must support it.

Rather than going into detail regarding the havoc it's wreaking specifically on a site I have under development, perhaps I can just ask the following because the situation is similar:

I'm on a Macintosh (OS 9.2.2) using Netscape 4.79 and the Milonic site (home page) will not load. It craps out after the pretty blue page background appears.

I view the source code, however, and it's all there. Any ideas what the problem may be? Does it have anything to do with it being a PHP page?

Speaking of PHP, I've never quite gotten a grasp on this: should the .js file extensions be changed to .php? I'm not sure why I thought this might be necessary but I could have sworn I had come across something in the forums regarding this but now I can't seem to find anything about it. Or maybe a better way of asking this is: If the menu is going to be used on PHP pages, does one have to do anything differently in order to get it to function correctly?

Forgive the long post but also, I've always wondered this: When you view the source code of an HTML page that uses the Milonic menu...in Netscape, all the javascript from the external javascript files is staring back at you. This isn't the case when viewed in Explorer. That's the way it's supposed to be, right?
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Someone probably has 4.79 and maybe could check things out, but without actually being able to see the page that's causing the problem so they can see the codes, it's kind of hard to check. The guys even without nn4.79 might be able to tell from the codes and such what the problem is.

Ruth
User avatar
Maz
Milonic God
Milonic God
Posts: 1717
Joined: Fri Jun 06, 2003 11:39 pm
Location: San Francisco
Contact:

Post by Maz »

Yes I remember seeing, changing js to php.

It would help to see a url, are you using xhtml? Then you need to enclose the script in CDATA.

Are you using external css for the styles, you don't want to do that for Netscape.

Regards
maz
pavia
Super Advanced
Super Advanced
Posts: 39
Joined: Fri Aug 16, 2002 2:39 pm

Post by pavia »

Okay...lemme try this again...

The Milonic home page craps out and doesn't load when I access it using Netscape 4.79 on my Macintosh.

I was asking if someone would perhaps know why this is happening (because I am experiencing identical behavior on a site I've been working on).

So, as far seeing a URL (and source code) um...http://milonic.com ;)

Regarding changing .js to .php, do you recall what the impetus for this was? Like, is it mandatory in order for things to function correctly?
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

Here's what I can contribute:
I'm on a Macintosh (OS 9.2.2) using Netscape 4.79 and the Milonic site (home page) will not load.
I don't have a mac I can test with so, unfortunately, I can't look at any site with any browser under any version of Mac OS. However, looking at the milonic site with NS4.75 under Win2k, the menu appears and functions well (except for the form in the search menu)... no general havoc.
I view the source code, however, and it's all there. Any ideas what the problem may be? Does it have anything to do with it being a PHP page?
No.
Speaking of PHP, I've never quite gotten a grasp on this: should the .js file extensions be changed to .php?
Not necessarily. It depends.
I'm not sure why I thought this might be necessary but I could have sworn I had come across something in the forums regarding this but now I can't seem to find anything about it. Or maybe a better way of asking this is: If the menu is going to be used on PHP pages, does one have to do anything differently in order to get it to function correctly?
[For the general audience:] PHP is a server-side scripting language (like ASP, JSP, others...). When using a server-side script, here's the boiled-down idea: There's a PHP server application running on the web server. The "whatever.php" file is processed through this server application, which interprets the php script. The php code causes the php interpreter to produce (output) html code, which is then served by (sent by) the web server to the client (the surfer). So, on the site visitor's end, he or she will not see the original php code; rather, he or she will see the html code that was generated by the php code.

The cool thing about this is the the html code that arrives at the site visitor's browser is generated dynamically, for each .php page visited. That means that the html code can be customized, before its sent from the server, to fit various changing conditions: the user, personal preferences, the current date... whatever. In the .php page, you can also have static html, or static anything else (e.g., .js files loaded) that does not change as a result of current conditions.

If you name a file with .php, then it will be processed through the php interpreter on the web server. If that file contains any php script ("commands"), then that script will be interpreted and the result will be output in the page being served to the visitor's browser. If that .php file does not contain any php commands, then it will still be processed by the php interpreter, but unnecessarily so, because nothing will change.

The upshot is that you would only need to name a file with .php if it contains php code. If the javascript in a .js file is to be the same under all conditions (i.e., it is static), then there is no reason to rename it to .php. Doing so would probably cause no harm, but it would also probably cause it to be processed by the php interpreter unecessarily... just wasting time on the server end. The only reason you'd want to rename the file from .js to .php is if you plan to put php code inside the file. Why would you want to do that? You could have php code in the file that dynamically generates the js code used to create the menus. So, whereas some of the js code would be straight, static, native js code, other js code that ends up on the user's side might actually be generated from the php code on the server. This would be a common approach, for example, of people using php to create the menus from a database. Hope that made sense. You'll note that milonic.com has much of the javascript in .js files (like milonic_src.js). That's because the contents of these files is not meant to change with conditions. But the menu_data is in menu_data.php... why? Because the menus are generated dynamically during each page visit. Why dynamically? Without seeting the php code itself, I don't know; but I would guess that the menus are being generated from a database.
Forgive the long post but also, I've always wondered this: When you view the source code of an HTML page that uses the Milonic menu...in Netscape, all the javascript from the external javascript files is staring back at you. This isn't the case when viewed in Explorer. That's the way it's supposed to be, right.
Right, under most circumstances. As far as I know, this is a peculiarity of NS4 (and some other stone-aged browsers), showing all the code that went into creating what the user sees. More modern browsers (including newer NS version) show the code as it exists on the page that was served. Keep in mind, however, that you don't see the original server-side scripting code, only the code that it produced.

Hope that helps at least some. Sorry I can't help with the Mac part of the problem.

Kevin
pavia
Super Advanced
Super Advanced
Posts: 39
Joined: Fri Aug 16, 2002 2:39 pm

Post by pavia »

Kevin--THANK YOU! I really appreciate your explanation with regard to PHP. Thanks for taking the time to provide it. Now if you only had a Macintosh I bet I'd be all set!! :D

Is there anyone out there with a Macintosh and old crappy Netscape who would be willing to take a shot at this?

Kevin--the reason I was asking if there was any correlation between the page crapping out in Netscape 4.79 and the fact that the Milonic home page is a php page is because with the site I'm working on that behaves the same awful way, if I remove the php stuff and then load the page, the problem doesn't occur. I guess I was looking for an easy answer, huh?
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

pavia wrote:...because with the site I'm working on that behaves the same awful way, if I remove the php stuff and then load the page, the problem doesn't occur...
Hi again,

When you "remove the php stuff" what exactly are you doing? Are you taking the php code out entirely, renaming the file to .htm or .html, then loading that into the browser? Or are you taking the php code out, renaming the file to .html, and manually inserting the client-side code (html) that the php would have generated, then loading it in the browser?

Kevin
pavia
Super Advanced
Super Advanced
Posts: 39
Joined: Fri Aug 16, 2002 2:39 pm

Post by pavia »

I'm taking the php code out entirely and renaming the file to .html.

There's really not a whole lot of php coding in there anyway. I just went to take another look at it and when it's the php page, part of the page loads and then it craps out and I get the extra added bonus of it messing up the browser and I have to quit and restart.

When I say "part of the page loads," picture a three column layout...left-hand side column, middle wide column for content and right-hand side column. Only the left-hand column shows up (left and right columns are simply php includes of html files).

But don't forget--the Milonic page behaves in a similar fashion. Were you thinking of something in particular that might be the cause?

P.S.--Thanks for helping me. ;)
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

I'm thinking that the php code is generating output that the poor ol' browser can't swallow... could well be something completely unrelated to the menu. Granted, the Milonic site may exhibit similar behavior, but it could simply be a similar result with a different root cause (i.e., did he crash into that tree because he was drunk, or because he was stoned?)

Let me ask you a few more questions. When you remove the php code, and rename the file to .html, you have what we'll call the "non-php page." Does the non-php page still load the milonic scripts (milonic_src.js, mmenudom.js, mmenuns4.js and your own file, normally named menu_data.js)? Are these files still named .js? You say that the non-php page loads OK and nothing craps out on you. Does that include the menu? In other words, in the non-php version, does the Milonic menu appear and does it work?
P.S.--Thanks for helping me.
No problem. Glad to help... just don;t know how much help I can be ultimately with a Mac :?

Kevin
pavia
Super Advanced
Super Advanced
Posts: 39
Joined: Fri Aug 16, 2002 2:39 pm

Post by pavia »

K--

--The non-php page loads the milonic scripts (milonic_src.js, mmenudom.js, mmenuns4.js and menu_data.js).

--The files are still named .js

--The non-php page loads OK, nothing craps out, the menu appears and it works.

(And I wasn't clear in my last post: with respect to the php page, the menu also loads and works--but the page doesn't fully load)
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

Sorry for the delay... hockey game. We won, 4 - 2... 3 - 0 within the first five minutes of the first period!!! Then they did this:

Code: Select all

iceBox.visitors.goalie.src = swapGoalie();
So, the menu loads and works in both the php page and in the non-php page. But the page won't fully load in the php version. What that tells me is that the problem is likely in the php code itself, and not really realted to the menu. Another diagnostic you could use to confirm this would be to remove, or comment out, the code that loads the .js file for the menu. In other words, suppose your menu scripts are loaded in the standard way, like so:

Code: Select all

<script language=JavaScript src="../../milonic_src.js" type=text/javascript></script>
<script	language=JavaScript>
if(ns4)_d.write("<scr"+"ipt language=JavaScript src=../../mmenuns4.js><\/scr"+"ipt>");
  else _d.write("<scr"+"ipt language=JavaScript src=../../mmenudom.js><\/scr"+"ipt>");
</script>
<script language=JavaScript src="menu_data.js" type=text/javascript></script>
You could either remove those lines from the php file, or comment them out so that they have no effect, using <!-- on the first opening tag and and --> on the last closing tag, like so:

Code: Select all

<!--script language=JavaScript src="../../milonic_src.js" type=text/javascript></script>
<script	language=JavaScript>
if(ns4)_d.write("<scr"+"ipt language=JavaScript src=../../mmenuns4.js><\/scr"+"ipt>");
  else _d.write("<scr"+"ipt language=JavaScript src=../../mmenudom.js><\/scr"+"ipt>");
</script>
<script language=JavaScript src="menu_data.js" type=text/javascript></script-->
Now, the menu script will not be loaded at all in the php page. Open the php page in your Mac browser... does it still not load correctly... same behavior as before, getting only the first column? My guess is that it'll still not load correctly. That would be additional (strong) evidence to suggest that it's the php code that's causing the problem.

Of course, then the trick would be to see exactly what code is the culprit. There are various things you could do at that point. Like, start removing parts of the php code, a little at a time. Also, you could create a php page (minus the menu code) and a non-php page (also minus the menu code). Open each page and view the source. When you view the source, save it to a plain html file... viewing the source of the php page and saving it should give you the output of the php to the browser. Viewing the source of the html version should give you pretty much exactly the same thing as the orihginal html version, but you should still view the source from the browser and save it. Now you can compare the two files to see what generated code is causing the failure (you could do it manually, or there are file utilities that will compare two files and highlight the differences). If you want, you could post the results of viewing and saving the source the two files here, or email them to me, and I could have a look (it would also be useful to have the original php file as well).

I won't be around much this weekend, and I'll be working on the road most of next week, so I'm not sure if I'll get much of a chance to look at it. I'm also extremely far from being well versed in php, but I'm willing to give it a try (and there are others here who are good at php who might also be able to help).

Cheers,

Kevin
pavia
Super Advanced
Super Advanced
Posts: 39
Joined: Fri Aug 16, 2002 2:39 pm

Post by pavia »

Well sh*t. I was all set to prove you wrong--I mean, if it's not the menu then how come the Milonic home page doesn't load in Netscape 4.79 either--and I can't because you were right. I commented out the menu...viewed it in Explorer and everything was a-okay as usual.

Viewed it in Netscape, and the page craps out the same way it does when the menu is not commented out.

Hmmm...looks like I am in the wrong forum, doesn't it? Uh, where's the PHP for dummies forum?

Thanks for your offer to help but I don't want to impose since it seemingly is not the menu causing the problem. Of course, I'd still like to know why the Milonic home page won't load in Netscape 4.79. :P

Congrats on the hockey game!
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

I'd still like to know why the Milonic home page won't load in Netscape 4.79.
Good question... probably the Milonic folks'll want to get the figured out too. Maybe they also have a php-to-NS4.79/Mac issue?

Anyway, at least you're on the right track. I'm sure you'll get it going. If you like, the offer to try to help still stands. Have a beer or two, and a good weekend.

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

Post by Ruth »

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.
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

I am going to download netscape for my mac, I can test safari and IE on it. But never thought to install netscape...will do. I will post what I experience with NS when I get home....if I remember. :oops:
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
User avatar
Ruth
 Team
 Team
Posts: 8763
Joined: Thu May 15, 2003 5:02 am
Location: Yucaipa, CA
Contact:

Post by Ruth »

Again, just for info...I'm not sure if you'll have the problem, but I found that netscape tried to take over everything on my computer. And, ultimately I ended up having to disable it for access to the web to stop conflicts that kept happening. Once I did that all the funny little glitches that were happening in my web editing programs and other things stopped.

Ruth
pavia
Super Advanced
Super Advanced
Posts: 39
Joined: Fri Aug 16, 2002 2:39 pm

Post by pavia »

Thanks for the input Ruth but I'm not asking about functionality in Netscape on the Windows platform. Glad it works for you though.

Also, I doubt Hergio has anything to worry about if he does install Netscape on his Macintosh--completely different operating systems, ya' know...and it's pretty obvious he knows what he's doing.

Anyhoo...I think I may have found the problem with my php page crapping out in Netscape 4.79 on the Macintosh...looks like it's being caused by my style sheet--specifically, some of the styles I had for form elements. I haven't finished figuring out exactly which one is doing it but I guess I'm on the right track. I just took them all out and the page eventually appeared although I have to say, it took an incredible amount of time to do so.

Hergio--if you do end up looking at the Milonic home page in Netscape 4.79 on the Macintosh, will you let me know what you see (can you do it in Classic)?

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

Post by Ruth »

Yes, I do know he's really knowledgeable, I also know you weren't asking about windows platform and I also know they are different operatings systems. But thanks for the info just in case I didn't
User avatar
kevin3442
Milonic God
Milonic God
Posts: 2460
Joined: Sat Sep 07, 2002 12:09 am
Location: Lincoln, NE
Contact:

Post by kevin3442 »

Hergio wrote:I am going to download netscape for my mac...
NS4.79? You're a brave man indeed Dave... ;)
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

Ok, crazy me decided to download and install Netscape Communicator 4.79 on my G4. Happy to say it hasn't seemed to have screwed up my computer at all as I have heard happen before. Hope it stays that way... :D

So I downloaded it and installed it, and as you asked pavia, I ran it in Classic mode. In fact, as far as I can tell, it can only be run in Classic mode. So I pulled up Milonic.com and it loaded, slower than I am used to but it all loaded. I was able to hover over all the menu's and they worked. Alittle clunky with some lag time, but nothing unusable. The hover tooltips even appeared when I stopped over certain menu items. One time I got the menu to freeze, but waiting about 5 seconds, they all closed and it worked again.

So it looks to me like the milonic homepage loaded and ran ok in Netscape 4.79 running in Classic mode on a G4 Powerbook running MacOSX 10.3. As you may know, the whole reason for the menuns4.js file is just for this one browser....alotta work for an old silly browser huh? Well, thats just the way the cookie crumbles I guess. Pavia, what OS you running on? Also do you think it may have something to do with certain plug ins you have installed to the browser?

Once we resolve this issue somehow, needless to say, I will be removing 4.79. ;)
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
Post Reply