Desperate website / menu / frames help . . . .

Associate
Joined
12 Jan 2003
Posts
1,227
Location
Watford
Hi All

I have been given the job of re-doing our surgery website in the next 72 hours.:eek:

I have been told that it needs to be something similar to this :

http://www.ridgeway-surgery.com/

I can do a bit of basic web design, but I am really struggling with the menu system. I have seen this menu :

http://www.dynamicdrive.com/dynamicindex1/ddlevelsmenu/index.htm

Which I would really like to incorporate onto the webpage. But what I want it do is that when a link is clicked from the menu system, in targets it to a central frame. I.e. having the menu bar on the right, and then a target frame in the middle.

I.e - this

I have spent hours fiddling round, but cant seem to get anything to work. If someone would be so kind as to help a poor soul, I would be eternally grateful !

Thanks

Mehul

PS I am not gettin paid a penny ! Great - huh !
 
Frames went out of fasion a while ago. Neither of those sites you linked have frames (well the first one does but that's only to keep the location bar pointing to the same address).
Just create 1 page with the menu and content where you want it then copy that page and change the content.

The links in the menu just have to go to the new page. No fafing with frames or targets. Only problem is if one of the links changes you have to redo all the pages.

If you know anything about asp or php I would use that as you can keep the menu in one place or bring it from a database and include it into every page that needs it.

Simon
 
Last edited:
The links in the menu just have to go to the new page. No fafing with frames or targets. Only problem is if one of the links changes you have to redo all the pages.


Thats exactly what I want to avoid. So my idea was that when the links are clicked the content is pushed onto a target frame, so that I only have to update the menu on one webpage.

I have done some reading about the IFRAME tag, would this be a possible solution ?

R

mehul
 
frames are bad regardless and are considered very bad practice. Hence why you generally only seem them on the worst of websites.

If you want to keep one instance of the nav and use it across all the pages, the easiest way is to just use php includes.
 
depending on your hosting package use include files.
classic asp and php can handle them.
you don't need to know much in the way of programming, you can just have the menus as HTML within an ASP page for example then use an include tag within the table cell / div tag you want the menu to appear.

so, in asp:
<div id=container>
<div id=menu><!--#include file="menu.asp"--></div>
<div id=content>blah blah</div>
</div>
 
If you can't/won't use asp/php the how about some javascript?
Works on ie7 and firefox. Older versions don't recognise "new XMLHttpRequest" though you can get round it with activex controls.
Code:
<html>
<head>
<script language="Javascript">
function popMenu(){
var oRequest = new XMLHttpRequest();
var sURL  = "http://"+self.location.hostname+"/test/menu.txt";

oRequest.open("GET",sURL,false);
oRequest.setRequestHeader("User-Agent",navigator.userAgent);
oRequest.send(null)

if (oRequest.status==200) {
document.getElementById('menu').innerHTML = oRequest.responseText;
} 
else {
document.getElementById('menu').innerHTML ="Error executing XMLHttpRequest call!";
}
}
</script>
</head>

<body onload='popMenu()'>
Text on page
<hr/>
<span id='menu'></span>
<hr />
Text on page
</body>
</html>

menu.txt has the html code for the menu in it.
Code:
Read text this is the menu
<br />
some text
<a href='#'>link</a>

Simon
 
good call simon. I forgot about that.

You could also use a framework like 'Prototype.js' or 'jQuery' which would allow you to call and update the content in a single javascript line:

Stick this within your <head> tag:
Code:
<script src="[URL]http://ajax.googleapis.com/ajax/libs/prototype/1.6.0.3/prototype.js[/URL]" type="text/javascript"></script>

then this on your page:
Code:
<script language="Javascript>
<!--
new Ajax.Updater('your_menu_div', 'yourmenupage.htm', { method: 'get' });
//-->
</script>

'yourmenupage.htm' would have the code as above in the .txt file in Simon's post.


....I think that would work anyway!
 
Last edited:
There is always that pesky problem of people who have javascript either blocked or disabled.

True, but it's either that or teach him how to install php/asp on a server he may not have permissions on, then teach him php/asp enough so he can write the pages all in 72 hours.
All across the internet.

sist_si
I'd not come across prototype.js, thanks for that!

Simon
 
no problem Simon. it really rocks....plus you have the benefit of Google hosting a lot of these new fangled frameworks and api's so you can link via them and save your site bandwidth!
jQuery has a similar vibe but i use prototype more. Couple it with Scriptaculous and you can do some really nice effects.
 
If you want to avoid people blocking the ads on the right (if they're just ads) then avoid using an iframe. First thing i block or is blocked by adblock on all websites i visit is iframes.

You could do the menu with pure CSS and HTML. No need to worry about people with javascript disabled then. There's soo many free CSS menus around now that work across browsers i'm surprised no one suggested it already.

Includes would be great in terms of updating code across pages as suggested already, i'd personally recommend PHP.

However i'd say you might gain some advantage focussing on cleaning up the code you have so far, i can see there's lots of CSS spread all over the place, and lots of classes defining the same thing over and over again.

I tend to notice as i'm on an old Socket A system now, and the heavier the code the slower the load times... :( Youtube is a nightmate for example.... :D
 
Back
Top Bottom