# Adding a topbar. (So can we do this or not Pirate Kitty / Morrus)??



## Michael Morris (Mar 3, 2003)

I have prepared a topbar specifically for the messageboards similar to the one in use on the Dusk Site but tailored to the messageboard.  A test of it is here:

http://enworld.cyberstreet.com/hosted/Dusk/messageboard/titlebar.php

The file uses JAVA script, but then again so does the UUB boards themselves, so none of the browsers on this site should have any problem with it.

The generating files are all in

http://enworld.cyberstreet.com/hosted/Dusk/messageboards/

They are

menuheaderscript.php
menubody.php
mm_menu.js
arrows.gif
titlebar.gif

Installation
Installing the menubars, is self contained.  If updates are needed later I can do this for you by changing the menuheaderscript.php file (I do not have to tamper with the main index file).

Place all the files above in the same directory as the forumn's index.php file.  Then add these two lines of PHP code.

Somewhere in the header of the file


```
include("menuheaderscript.php");
```

Immediately after the body tag...


```
include("menubody.php");
```

The whole thing is only 20 pixels high, and I think it will be very useful.  Though I suspect that it is possible to create an alternate index file on the boards to test this, I didn't want to try since its not my place to tamper with the boards.

Anyway Russ, Piratecat, I'd really like this to see use.  What do you say?


----------



## Michael Morris (Mar 3, 2003)

Just checked the spacing... The table code will be necessary.  This is *approximately* what it will look like with the code.

http://enworld.cyberstreet.com/hosted/Dusk/messageboard/sample.gif

I've been doing multiple edits to this post to get the appearance right.  Seems the UUB translator tries to process html commands - I thought that was turned off, but oh well.


----------



## Psionicist (Mar 3, 2003)

Excellent work.

For the admins: If the above installation doesn't work. try

<?php include("menuheaderscript.php"); ?>

and

<?php include("menubody.php"); ?>

Edit: Damn board formatting.


----------



## Michael Morris (Mar 3, 2003)

Darn it, I tried 6 times to get the boards to stop processing the PHP code with the tags... How did you do that?


----------



## Psionicist (Mar 3, 2003)

Michael_Morris said:
			
		

> *Darn it, I tried 6 times to get the boards to stop processing the PHP code with the tags... How did you do that? *




Quote my post, it's standard "HTML special characters codes" ( & g t ; without the spaces for example)


----------



## Horacio (Mar 3, 2003)

Michael_Morris said:
			
		

> *Darn it, I tried 6 times to get the boards to stop processing the PHP code with the tags... How did you do that? *





```
[COLOR=silver]He used "& lt" (without the space) 
instead of "<" and "& gt" (also w/o space) 
instead of ">"[/COLOR]
```




And I like a lot the menu bar


----------



## Michael Morris (Mar 3, 2003)

Ok, that's useful to know...

Actually, I should have thought of that.. Oh well - I'm too dependent on Macromedia Dreamweaver to encode special characters for me


----------



## Terraism (Mar 3, 2003)

Darkness made a good point, in that it could be a resource eater, but I doubt it.  Either way, if it works, I'm voting for it.


----------



## Psionicist (Mar 3, 2003)

*Terraism:* Shouldn't be a problem as it's at least 90% JavaScript, which runs locally and not server-side.


----------



## Darkness (Mar 3, 2003)

Terraism said:
			
		

> *Darkness made a good point, in that it could be a resource eater, but I doubt it.  Either way, if it works, I'm voting for it. *



Here's Michael Morris' response to my query, BTW:



			
				Michael_Morris said:
			
		

> *This is how much memory the two included files need...
> 
> menubody.php  1687 bytes
> menuheaderscript.php  20,474 bytes
> ...


----------



## Michael Morris (Mar 3, 2003)

Terra's right, it's JAVA script so it isn't going to suck up your processor's power - download time could be a problem, but even in the cast of 28.8 it's not that bad.

The server's only contribution is the upload time.  And I would point out that more than a few folks have 'sigs well in excess of 21 K, so I don't *think* this addition is that much of a problem.


----------



## Dragongirl (Mar 3, 2003)

It's and interesting idea, but with the boards already slowed down by all the 3.5 news gawkers (and I mean that in a nice way) I would rather not see something that slows it down more, even if only a few seconds a page.  Can you make it optional?


----------



## Darkness (Mar 3, 2003)

Michael Morris has since checked it again and found that the extra time is only 1/8 of the original estimate, BTW.
So it's not a biggie.


----------



## Michael Morris (Mar 3, 2003)

Darkness said:
			
		

> *Michael Morris has since checked it again and found that the extra time is only 1/8 of the original estimate, BTW.
> So it's not a biggie.  *




I spoke too soon.  My initial pessimistic outlook was correct.


----------



## Michael Morris (Mar 3, 2003)

Dragongirl said:
			
		

> *It's and interesting idea, but with the boards already slowed down by all the 3.5 news gawkers (and I mean that in a nice way) I would rather not see something that slows it down more, even if only a few seconds a page.  Can you make it optional? *




Making it optional would require altering the messageboard code in a major fashion.  That said, it *theoretically can be done (It's a question of omitting 2 include calls).


----------



## Darkness (Mar 3, 2003)

Michael_Morris said:
			
		

> *I spoke too soon.  My initial pessimistic outlook was correct. *



Damn - that sucks.


----------



## Michael Morris (Mar 3, 2003)

BTW, if you want to get a firm idea on how this would affect downloads, visit the Dusk pages (empty your cache first if you've been there before).  The code used on those pages is virtually identical to what I'm suggesting.


----------



## Blacksway (Mar 3, 2003)

Don't mean to throw cold water on what is quite a nice looking menubar, but I can't seem to get it working in Netscape. Has anyone tried it on a Mac?


----------



## Michael Morris (Mar 3, 2003)

Version?  Netscape isn't 4.0 compliant until version 5.0 (which is the main reason they lost out to MSIE).


----------



## Blacksway (Mar 3, 2003)

I was using netscape 4.7. Still a browser we check for here at work. (I'm a web developer)


----------



## Michael Morris (Mar 3, 2003)

I don't know how to write a browser detection program.  Even if I did, I don't have the time to write 10 versions of the same script.  Netscape 4.x sucks.  It is the reason NS tanked and had to sell out to AoL after MSIE 4.  NS has no one to blame but themselves.


----------



## Michael Morris (Mar 3, 2003)

Bump..  Well?


----------



## orbitalfreak (Mar 3, 2003)

Cool beans!  Looks nice, I had fun playing around with it on the test page.  Adds a little something to the site.  I'd like to see it used.


----------



## Michael Morris (Mar 4, 2003)

So are we going to do this or not??


----------



## Morrus (Mar 4, 2003)

Well, from the above it looks like it won't work with some browsers.


----------



## Michael Morris (Mar 5, 2003)

There's a lot of things that won't work with Crapscape 4.x.  Argh.. I'll write a browser detection routine.


----------



## Michael Morris (Mar 5, 2003)

Ok, I changed the code for positioning from a div tag to a span tag which tends to work better on Crapscape.  I have tested the change on IE 6.0 and Crapscape 6.2 and it works fine.


----------



## Michael Morris (Mar 5, 2003)

I have a preliminary script in PHP that prevents all non MSIE browsers and all Netscape browsers prior to Mozilla/5.0 from seeing the page.  I need help testing this script (It seems to work, but I don't have a non-standard browser).

The script first checks for MSIE.  If that doesn't go OK it checks for Mozilla/5.0 - The newer NS browsers and some of the newer browsers return this as part of their $HTTP_USER_AGENT Query string.  I **Think** that all browsers that return this value properly process the JAVAscript this file needs - those that don't (such as my least favorite browser in the world NS 4.x) will be told that their browser isn't supported.

In a final version of the page the topbar simply wouldn't be loaded.

Upon further examination of the code - it would be possible to add turn the topbar on and off using a code variable contained in the cookie that holds the rest of the user's options (like whether or not to see 'signatures, view avatars, etc).  How simple this would be I don't know.


----------



## Fast Learner (Mar 5, 2003)

Michael_Morris said:
			
		

> *The file uses JAVA script...*



You've said this a couple of times, but for clarification you mean it uses Javascript (also known as Jscript or ECMAscript), right, not a Java script (also know as a Java Applet). They are two dramatically different things, and if it's the latter, PLEASE allow it to be turned off in the control panel. When I surf from my old PII 300 laptop (sometimes), if an applet is loaded at any point, my machine crawls to a snail's pace (even if the applet is no longer in any browser window) -- very evil.


----------



## Michael Morris (Mar 5, 2003)

*Re: Re: Adding a topbar. (So can we do this or not Pirate Kitty / Morrus)??*



			
				Fast Learner said:
			
		

> *
> You've said this a couple of times, but for clarification you mean it uses Javascript (also known as Jscript or ECMAscript), right, not a Java script (also know as a Java Applet). They are two dramatically different things, and if it's the latter, PLEASE allow it to be turned off in the control panel. When I surf from my old PII 300 laptop (sometimes), if an applet is loaded at any point, my machine crawls to a snail's pace (even if the applet is no longer in any browser window) -- very evil. *




It's antiquated pieces of junk like that I am trying to block from loading this script, just in case  

And I do know the difference between the two.  If you refrain from lecturing me like a child about the differnce I'll refrain from saying you seriously need a real computer.


----------



## Dragongirl (Mar 5, 2003)

*Re: Re: Re: Adding a topbar. (So can we do this or not Pirate Kitty / Morrus)??*



			
				Michael_Morris said:
			
		

> *And I do know the difference between the two.  If you refrain from lecturing me like a child about the differnce I'll refrain from saying you seriously need a real computer. *



Real computer?  Well then put me in the ranks of those not wishing for this new thing unless it can be turned off easily, or better yet not turned on unless switched on.  That news ticker almost did me in, no telling what this will do.


----------



## Horacio (Mar 5, 2003)

*Re: Re: Re: Adding a topbar. (So can we do this or not Pirate Kitty / Morrus)??*



			
				Michael_Morris said:
			
		

> *
> 
> It's antiquated pieces of junk like that I am trying to block from loading this script, just in case
> 
> And I do know the difference between the two.  If you refrain from lecturing me like a child about the differnce I'll refrain from saying you seriously need a real computer. *




Sorry, Michael, but there you have been offensive against hundreds of us who can't afford a "real computer". At work I have a sad P350 and I can't change it, I'm stuck with it and I don't want to be unable to browse my favorite forums. At home I have a pc a bit better, but I bet you won't think of it as a  "real computer", and no, I can't afford a better one. So please, refrain yourself from doing that kind of comment.


----------



## Michael Morris (Mar 5, 2003)

*Re: Re: Re: Re: Adding a topbar. (So can we do this or not Pirate Kitty / Morrus)??*



			
				Horacio said:
			
		

> *
> 
> Sorry, Michael, but there you have been offensive against hundreds of us who can't afford a "real computer". At work I have a sad P350 and I can't change it, I'm stuck with it and I don't want to be unable to browse my favorite forums. At home I have a pc a bit better, but I bet you won't think of it as a  "real computer", and no, I can't afford a better one. So please, refrain yourself from doing that kind of comment. *




I was joking Horacio - or did you miss the smiley.

I have several computers at the house.  I test my pages using my old Pent III 366 Celeron, which is just as bad as what your using.

I understand that not everyone has a high end system.  Why do you think I spent the last 4 hours writing a blocker script to prevent the topbar macro from displaying on older browsers that tend to mess up javascript programs?  (And for the record, I've never used JAVA applets - those things aren't even reliable or trustworthy on high end systems).

The solution I settled on was to search for MSIE or Gecko in the $HTTP_USER_AGENT string.  This weeds out Netscape 4.x  (Sorry, but no one should use that piece of crap.  I'd go back to NS 3.0 before I'd use NS 4.x) and most earlier browsers.  It does not weed out MSIE 2.0 and 1.0 - but I think it unlikely any sane person would use either of those in preference to the NS versions out at the same time and in any event, they can't handle the UUB board code itself anyway, so it's a bit of a moot point.  Another possible hole is a browser known as Opera.  Opera claims to be MSIE in it's user agent string, but it is not.  I've heard that it's earlier versions have rather flaky JAVAscript support.

Doce and I tested the script out pretty thoroughly last night and I think it will work.

The point of all this testing is to insure that the thing will function on the browsers that support it without damaging the functionality of pages on the browsers that do not support it.

As a footnote Horacio, a Pent 350 should run IE 5.x.  When I refer to "real computers" I mean anything made in the last 5 years - pretty much Pent II or better.  Even with slower machines - it's the MODEM that kills computer speeds, not the processor.  Still, I have a relative that constantly irks me because she has problems browsing web pages using a 486 that she put Win 95 on (BIG mistake).  That's the kind of system I was thinking of when I was "being snooty."


----------



## Horacio (Mar 5, 2003)

*Re: Re: Re: Re: Re: Adding a topbar. (So can we do this or not Pirate Kitty / Morrus)??*



			
				Michael_Morris said:
			
		

> *
> 
> I was joking Horacio - or did you miss the smiley.
> 
> I have several computers at the house.  I test my pages using my old Pent III 366 Celeron, which is just as bad as what your using.*




I guess I missed the joke, maybe because the smiley was before the phrase... But then I don't understand your comment when he said he used a PII 300 laptop 



> *  Another possible hole is a browser known as Opera.  Opera claims to be MSIE in it's user agent string, but it is not.  I've heard that it's earlier versions have rather flaky JAVAscript support.*




In fact, I'm an Opera user... Yeah, right now I'm browsing and posting it with my Opera 7.0... 



> *As a footnote Horacio, a Pent 350 should run IE 5.x.  When I refer to "real computers" I mean anything made in the last 5 years - pretty much Pent II or better.  Even with slower machines - it's the MODEM that kills computer speeds, not the processor.  Still, I have a relative that constantly irks me because she has problems browsing web pages using a 486 that she put Win 95 on (BIG mistake).  That's the kind of system I was thinking of when I was "being snooty." *




And what about all those Linux/Unix/workstation users? They have no IE on it, and they are not as few as you could think. In fact, many times at work I connect from a Sun workstation, using sun navigator or a crappy Netscape 4.7. 

Please, don't take anything ofthis as an attack. But many people, for many different reasons, are unable to use IE. Specially in enterprise environments when you can't install the programs you would like to. Operating systems, administrators rights, entreprise politics, all that make many people to browse the boards from substandard machines or non Wintel machines, and that people should be able to browse it without problems. If you can do it, it will be great, if not, I wouldn't like the topbar. Ideally, it should be able to be turned off at will, as the news ticks.

Another concern of me is bandwidth. 22 kb can't seem a lot... for an individual user, but what about the boards? 22 kb for each page, with thousands of page loadings every day, couldn't it make a big difference in traffic?

In fact, those 22kb can makea big difference to slow connections, so I'm 100% for a topbar that allows user to turn it off, like the news ticks

Once again, this is not an attack, please don't take as it, only sincere concerns.


----------



## Michael Morris (Mar 5, 2003)

Horacio said:
			
		

> *
> 
> 
> 
> ...




Opera 7.0 is reputed to have stable JAVAscript support.



> *
> And what about all those Linux/Unix/workstation users? They have no IE on it, and they are not as few as you could think. In fact, many times at work I connect from a Sun workstation, using sun navigator or a crappy Netscape 4.7. *




The topbar won't appear.  That's what the blocker script is for.  I'm not recommending this be implemented to replace anything.  I'm recommending it as a supplement.



> *
> Please, don't take anything ofthis as an attack. But many people, for many different reasons, are unable to use IE. Specially in enterprise environments when you can't install the programs you would like to. Operating systems, administrators rights, entreprise politics, all that make many people to browse the boards from substandard machines or non Wintel machines, and that people should be able to browse it without problems. If you can do it, it will be great, if not, I wouldn't like the topbar. Ideally, it should be able to be turned off at will, as the news ticks.
> *



*

I am not familiar with the UUB code that drives the boards, but if a checkbox can be added to set the value of a variable in the user's profile, it should be able to be turned off.  It's a simple matter of querying the variable - even less complicated than querying $HTTP_USER_AGENT since you will know the two possible values of the queried variable.





Another concern of me is bandwidth. 22 kb can't seem a lot... for an individual user, but what about the boards? 22 kb for each page, with thousands of page loadings every day, couldn't it make a big difference in traffic?


Click to expand...




I don't think so.  And browsers that fail the check wouldn't count - the server skips the includes statements that trigger the download of the relevant files.  The same holds true for allowing users to turn this on or off at the profile level - the includes are never issued and therefore they never cross the phone wires.  The determining script itself adds about 600 bytes to the files size of the master index file.*


----------



## Dragongirl (Mar 5, 2003)

While you are at it, can you have the AOL browser be banned from loading it?   Thanks.


----------



## Michael Morris (Mar 5, 2003)

Dragongirl said:
			
		

> *While you are at it, can you have the AOL browser be banned from loading it?   Thanks. *




Any particular reason?  If it's Gecko enabled it should display properly.


----------



## Dragongirl (Mar 5, 2003)

Michael_Morris said:
			
		

> *Any particular reason?  If it's Gecko enabled it should display properly. *



For 2 reasons.
1) I don't use a "real comptuer" so don't want to see it.
but mostly because
2) AOL browsers already have a problem on this board with voting and the old news ticker.


----------



## Michael Morris (Mar 5, 2003)

The question is, does the broswer run the script properly (Follow the link from the first page to test it).  If it doesn't run I can try to find a way to block it.

If it does run the script then, no, I can't block it.  Just because you don't want to see it wouldn't mean anyone using that browser would not want to see it.  That's the sort of thing that user preferences are for.

The script I'm currently working on is a compatibility filter only.


----------



## Horacio (Mar 5, 2003)

ok, Opera 7 browses the topbar well.

But I still want it to be optional, I think everybody should be able to choose it. I know that with PHPBB boards it can be done easily, so I guess that here with UBB it can be done easily too (fairly similar software, AFAIK).

Edit: yes, User preferences is the good place to let each person to choose if they want it. If it can be done without problem, as I guess, I'm ok for the bar


----------



## Dragongirl (Mar 5, 2003)

Michael_Morris said:
			
		

> *The question is, does the broswer run the script properly (Follow the link from the first page to test it).  If it doesn't run I can try to find a way to block it. *



It works in AOL 8.0  
Took 6.5 seconds to load up.


----------



## Piratecat (Mar 5, 2003)

Does it take 6.5 seconds on every new screen? If so, then it's just too slow, no matter how cool (and make no mistake, it's extremely cool) it is.


----------



## Dragongirl (Mar 5, 2003)

Piratecat said:
			
		

> *Does it take 6.5 seconds on every new screen? If so, then it's just too slow, no matter how cool (and make no mistake, it's extremely cool) it is. *



Takes that long every times I click the first link.  But I don't know how it would behave if it was going to another page on the server instead of starting over.


----------



## Psionicist (Mar 5, 2003)

22kb equals one smaller signature image, 2-4 avatars or one lengthy post (such as a story hour), so bandwidth is no concern, really.


----------



## Fast Learner (Mar 5, 2003)

*Re: Re: Re: Adding a topbar. (So can we do this or not Pirate Kitty / Morrus)??*



			
				Michael_Morris said:
			
		

> *It's antiquated pieces of junk like that I am trying to block from loading this script, just in case
> 
> And I do know the difference between the two.  If you refrain from lecturing me like a child about the differnce I'll refrain from saying you seriously need a real computer. *



Well, FYI, the laptop in question is a 2 lb Sony with a WiFi card (utilizing my 500k DSL line) that I cart around my house for browsing message boards. It's running IE 6, so browser detection code certainly isn't going to keep my antiquated piece of junk from loading the menu. It's just Java applets that slow the machine down. 

No, it's not the 2Ghz P4 that I do my work on, true. But I strongly suspect I shouldn't have to have that kind of power to read some HTML bulletin boards, should I? Here's a smiley so I can say what I want but not be offensive: 

And, since you know the difference between Javascript and Java, but continue to refer to it as "JAVA script" or "JAVAscript," which one are you actually using?


----------



## Michael Morris (Mar 5, 2003)

Ok, somebody sent me a private command with will allow the browser to cache the code for the top bar.  I'm going to incorporate this into the code and if it works then the download will only need to occur once.  That removes the last major concern about the topbar (download speed).


----------



## Michael Morris (Mar 5, 2003)

*Re: Re: Re: Re: Adding a topbar. (So can we do this or not Pirate Kitty / Morrus)??*



			
				Fast Learner said:
			
		

> *
> And, since you know the difference between Javascript and Java, but continue to refer to it as "JAVA script" or "JAVAscript," which one are you actually using? *




It is a script.  A very long one, but just a script.


----------



## Michael Morris (Mar 5, 2003)

Dragongirl said:
			
		

> *Takes that long every times I click the first link.  But I don't know how it would behave if it was going to another page on the server instead of starting over. *




That's the nature of PHP - no caching - however I found a way to cache it and just tested it.  The script still works - but I'm not absolutely sure it's caching.  I'm going to make these changes to the Dusk site.  In the meanwhile, please test to make sure it's caching.  My connection is so damn fast I have no way of knowing the difference between cached and non-cached files.  :\


----------



## Jeph (Mar 5, 2003)

Ick. It slows down my comp. Okay then, it hurts Mac users, too . . . This doesn't seem like a good idea, as it only flows smoothly for Microsoft users with IE.


----------



## Michael Morris (Mar 5, 2003)

Jeph said:
			
		

> *Ick. It slows down my comp. Okay then, it hurts Mac users, too . . . This doesn't seem like a good idea, as it only flows smoothly for Microsoft users with IE. *




How would you know?  Don't go around throwing unqualfied statements.  This is not going to slow a computer down unless it is already *slow* to begin with.  And by slow I'm talking less than 200 mhz.

The initial load will be slow...  The JAVAscript file is 50 KB.  But if that sounds big, remember that a lot of the avatars and 'sig files are WELL in excess of that.


----------



## Michael Morris (Mar 5, 2003)

*First results..*

The code was implemented on the Dusk site and cut download times to 1/5th their intial times.  It's working, and working very well.


----------



## Dragongirl (Mar 5, 2003)

Nothing is cacheing from the Dusk site for me.  Takes 6 seconds each time.



			
				Michael_Morris said:
			
		

> *The initial load will be slow...  The JAVAscript file is 50 KB.  But if that sounds big, remember that a lot of the avatars and 'sig files are WELL in excess of that. *




Actually all avatars have to be under 5 KB, there is no way for any of them to be larger than that.

Edit : Though it may be my security settings not let it cache.


----------



## Piratecat (Mar 5, 2003)

Hey, folks - click on Michael's sig and see the toolbar at his site. Let us know if you have any problems.


----------



## Michael Morris (Mar 5, 2003)

Dragongirl said:
			
		

> *
> 
> Edit : Though it may be my security settings not let it cache. *




If that is the case you should experience this problem on any page you load, not just this one.


----------



## Dragongirl (Mar 5, 2003)

All I know is that it takes 6 seconds to load the first page of Dusk, 5-6 seconds for any of the links to load even if I go back to a page I have seen.  Last I will say about it.


----------



## Michael Morris (Mar 6, 2003)

Poll on this topic here along with my final thoughts on this subject.

http://enworld.cyberstreet.com/showthread.php?s=&threadid=43134

And General Forumns was chosen because this is an issue that will affect everyone, so as many people as possible need to participate in the discussion rather than have it hidden down here   Course if you don't agree with me guys, go ahead and move it.


----------



## Morrus (Mar 6, 2003)

OK, I have a couple of questions:

1) How easy would it be for me to edit it?  Would I be able to do so from a central location, or would I have to edit every instance of the menu?

2) Does any part of the proces use any server resources, or is it all at the browser end?  We're fairly close to the knuckle these days, as can be seen from the occasional slowdowns.

3) It's Natural 20 Press, not Natural d20 Press! 

4) It's EN World, not ENWorld. 

5) Could this potentially cauise a *problem* for any user because of their system, browser, or whatnot?

Possibly more questions at a later date.


----------



## Michael Morris (Mar 6, 2003)

Morrus said:
			
		

> *OK, I have a couple of questions:
> 
> 1) How easy would it be for me to edit it?  Would I be able to do so from a central location, or would I have to edit every instance of the menu?*




With _Fireworks_ I can edit it quite easily.  Without that program you'd need to be a fairly skilled JAVA script writer to modify it.  _Fireworks_ is a $300 piece of software, so I don't expect you to purchase a copy.  That said, only one file needs to be changed to change the dropdown menus that appear...



> *
> 2) Does any part of the proces use any server resources, or is it all at the browser end?  We're fairly close to the knuckle these days, as can be seen from the occasional slowdowns.*




The server must execute a script to determine whether the browser is capacle of running the script.  That determination is done in only 10 lines of code.



> *3) It's Natural 20 Press, not Natural d20 Press!
> 
> 4) It's EN World, not ENWorld. *




I'll make these changes within the hour on both Dusk and the example site.



> *5) Could this potentially cauise a *problem* for any user because of their system, browser, or whatnot?*




Preventing this is what the script is for...

Allow me to analyze the code this uses.  This should make the answers to some of the questions above clearer and also answer some unasked questions which are pertinent.

As I'm sure you're aware, any HTML file has a header and a body.  The code that drives this is split into two sections - one in the header and one in the body.  The header section starts off as follows:
*


		PHP:
	

<?php
if (strpos($HTTP_USER_AGENT, 'MSIE') <> false) {
		  echo "<script language=\"JavaScript1.2\" src=\"topmenu.js\"></script>";
}	elseif (strpos($HTTP_USER_AGENT, 'Gecko') <> false) {
		  echo "<script language=\"JavaScript1.2\" src=\"topmenu.js\"></script>";
}

?>

*
Sorry if it's a little hard to read, but PHP colorization makes the code easier to follow (if hard on the eyes).  This pair of if statements checks a variable called $HTTP_USER_AGENT.  This is a reserved variable set by the browser to tell the server it's name, version number, OS, and anything else the makers of the browser want to say.  The check is done with the strpos command because this uses the least amount of server processor time possible.  The command returns the numerical value of the position of our search string ("MSIE" in the first query and "Gecko" in the second).  If the string isn't found, it returns the reserved value of "false."  Hence if the answer to both those questions turns out to be false the server inserts nothing at all into the final HTML file that is sent to the browser.  If either one is true the echo command adds this one line of HTML code to the file that goes to the browser...

*<script language="JavaScript1.2" src="topmenu.js"></script>*

This command is similar to the PHP include command - the contents of topmenu.js are loaded by the browser and then included into the HTML file at the point it appears.  Note that because the browser did the inclusion (and not the server) it will cache the file.  This is important - that file is 50K in size and downloading it repetatively would slow the boards down a lot for everyone.   Also note that the file can be included anywhere you want on the site _so long as it is beneath the site root_.  Sites that use a lot of Javascripts will often make a folder for them called "scripts," or "JAVA" for the same reason that it is customary to put all images in an "images" folder.  This doesn't need to be done - the _Dusk_ site has only the one copy in the root.  Since all the other files are referring back to a root copy changing that copy changes all pages referring to it at once.

With one more if statement, the code above can be modified to check the cookie that contains the user's UUB preferences.  An extra variable will need to be added to that cookie, with a value of true (I want it) or false (I don't want it) (or the equivalent).  I recommend having the menus be the default option.


The next section of code appears in the body.  It is almost identical to the header's code because it is making the same determination.


```
[b]<?php
if (strpos($HTTP_USER_AGENT, 'MSIE') <> false) {
				  include("./menu/_menubody.php");

}   elseif (strpos($HTTP_USER_AGENT, 'Gecko') <> false) {
				  include("./menu/_menubody.php");
}
?>
```
[/b]

This makes the determination whether or not to include the menu code in the body.  The version used on the _Dusk_ site differs from the demo because _Dusk_ uses a larger image bar with two exta hot spots.  Also, by using an include here modifications only need be done once.  The code contained in that file drives the image map itself, which is a simple gif file called "titlebar.gif."  It also includes one spacer table..

*<table width=“100%” height=“20” border=“0” cellpadding=“0” 
cellspacing=“0”>
<tr>
<td></td>
</tr>
</table>*

The purpose of this table is to prevent the existing page contents from appearing underneath the title bar, which is itself a layer.  The table fills the space underneath the layer containing "titlebar.gif"

Oh well, I'll get to those requested changes now.


----------



## Morrus (Mar 6, 2003)

Michael_Morris said:
			
		

> *
> 
> With Fireworks I can edit it quite easily.  Without that program you'd need to be a fairly skilled JAVA script writer to modify it.  Fireworks is a $300 piece of software, so I don't expect you to purchase a copy.  That said, only one file needs to be changed to change the dropdown menus that appear... *




This, I'm afraid, makes it extremely unlikely that I'll use the menu.  I need to be able to change things easily and quickly myself.  New areas of the site regularly appear, and other areas move or are removed.  Sorry, Michael - too complicated pour moi!

I didn't even try to read the rest of your post. Looks like ancient Babylonian to me!

Please try and remember that I know how to use a basic WYSIWIG HTML editor and a vBulletin admin page . . . and that's about as far as my command of these things goes, including most of the explanations I get given.  I don't speak the language, I'm afraid!


----------



## Michael Morris (Mar 6, 2003)

I was able to make the changes you requested in 5 minutes.  I only had to change the contents of one file to do it.  As I've said before, I'm willing to help set this up and maintain it.


----------



## Morrus (Mar 6, 2003)

Michael_Morris said:
			
		

> *I was able to make the changes you requested in 5 minutes.  I only had to change the contents of one file to do it.  As I've said before, I'm willing to help set this up and maintain it. *




Yes, but I can't ask you to be around 24/7 until I stop running this site, just in case I wish to change it. 

I need to be able to easily alter it myself.


----------



## Michael Morris (Mar 6, 2003)

Morrus said:
			
		

> *
> 
> Yes, but I can't ask you to be around 24/7 until I stop running this site, just in case I wish to change it.
> 
> I need to be able to easily alter it myself. *




I'm going to attach it so you can see it.  *Some* alterations are easily made, others are much tougher.  Every menu option has a line like this in the code near the front.

mm_menu_0028013900_0.addMenuItem("Contact Russ",*"location='mailto:morrus@d20reviews.com'"*);

If you change what is in bold, and leave the rest alone, you can change the URLs in the file.  That is relatively simple.

mm_menu_0028013900_0.addMenuItem("*Contact Russ*","location='mailto:morrus@d20reviews.com'");

Same line of code.  The bold section this time is the text that appears in the menu box.  You could change that as well.

Here's an example with a true URL and not a the one that links to your mailbox....

 mm_menu_0028013207_1.addMenuItem("Dusk",*"location='http://enworld.cyberstreet.com/hosted/Dusk/'"*);

Again, if Dusk were moved, that would be the section of code you'd change.

Does knowing how to change the contents of the menu boxes help any?  Adding or detracting the number of boxes still needs _Fireworks_, but this doesn't happen on a daily basis.  Since I started this system mirroring the front page I've only had to change it *once* to keep up with you.

I know I can do this Russ, if you'll let me.  You don't need to do everything - there are people willing to donate their time to help out, if you will let us.

That


----------

