IFRAMES issue

Having problems with DHTML Menu? There is usually somebody here who knows the answer.
Post Reply
User avatar
fredlongworthhighschool
Mega Advanced
Mega Advanced
Posts: 362
Joined: Fri Jun 27, 2003 11:34 am
Location: Manchester, England.
Contact:

IFRAMES issue

Post by fredlongworthhighschool »

I don't think this is a MM coding problem, just general HTML. I've uploaded the tests I'm doing with V5 so you can see the problem I'm having:

http://www.flhs.org.uk/v5test

Only 'Heads intro' and 'accreditations' in the ABOUT section work at present.

The problem is to do with the scroll bars. Ideally, it would be great if the menu bar stayed at the top of the screen, but its not essential.

I'm not sure which is the best way to go about things. My site currently uses V3 frames but I want to get it over to V5 ASAP, but I don't know whether to:

Use IFRAMES
Wait to see if a FRAMES version is created
Use a third alternative

I'd welcome any suggestions from you all.

Thanks.

Andy
Andy Davis
Web Designer & Smartboard Manager

Fred Longworth High School, Manchester, England.
User avatar
Andy
Milonic
Milonic
Posts: 3308
Joined: Sun May 19, 2002 8:23 pm
Location: Menu Developer
Contact:

Post by Andy »

There's no contest. Ditch the Frames ;)

I've always hated frames and unfortunately the v5 frames based menu is not yet on our list of priorities.

There are many advantages to having a non-framed site and if you use PHP or ASP you can put headers in all your pages that will do the same job as frames.

Cheers
Andy
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've tried this, adding a #include routine on every page to call a HTM file with the two JS files in it, but it just doesn't work.
Andy Davis
Web Designer & Smartboard Manager

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

Post by fredlongworthhighschool »

If I preview it in Dreamweaver, it works fine. But when I try it out of Dreamweaver, it doesn't.

Will it only work if it has been uploaded to a website?
Andy Davis
Web Designer & Smartboard Manager

Fred Longworth High School, Manchester, England.
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

Are you using IIS? If you are, you should stop using .htm files and make them .asp files. Then you can do the <!--#include virtual='banner.asp' --> stuff and make your life easier. If thats what you're trying to do, then yeah it won't work unless the pages are on your server, becuase ASP is a server side language and needs to be parsed by IIS. If you can get IIS running on your test machine (win2000,xp have it) you can test it there and the ASP will render.

p.s. I agree with Andy...frames bad, me no like frames.
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
User avatar
fredlongworthhighschool
Mega Advanced
Mega Advanced
Posts: 362
Joined: Fri Jun 27, 2003 11:34 am
Location: Manchester, England.
Contact:

Post by fredlongworthhighschool »

Hmm, that would make things really difficult for running it locally. We do have an internal webserver running 2000 Server and I am currently working on an XP Pro machine. IIS appears to be active, but I'm still not getting anything.

Did you manage to sort out the IFRAME scrolling problem you were having?
Andy Davis
Web Designer & Smartboard Manager

Fred Longworth High School, Manchester, England.
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

Well if you can get it going, definetly consider trying to use includes...it will make your life alot easier. Regarding the scrolling problem, I found this example that seems to work. Its basically the iframe telling its parent what its size is and then the parent resizing the iframe on the fly. Give it a try. http://www.milov.nl/forum/1/1767 I am about to too.
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
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've had a look at it, but it doesn't seem very clear where to implement each bit of code and in what file.

My 'main' page containing the menu system and title page is called DEFAULT.HTM and then I have lots of other pages sorted into folders. For sake of argument, lets just call them PAGE1.HTM, PAGE2.HTM and so on.

From here can you explain where in each file the code from that site goes?
Andy Davis
Web Designer & Smartboard Manager

Fred Longworth High School, Manchester, England.
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

Ok, give this a try:
your PAGE1 and PAGE2 files should have a BODY tag that looks like:

Code: Select all

<body style="margin:0;border:0;" scroll="no">
This way, when it renders in the iframe, it will look its best. Then at the bottom of your PAGE1 and PAGE2 pages, right before the </BODY> tag, put this...

Code: Select all

<script DEFER>parent.resizeMe(self.name,document.body.scrollWidth,document.body.scrollHeight)</script>
This will tell the page to look to its parent, and call the resizeMe function thats defined in its parent, and its passes its name and its dimensions so the parent can resize the iframe accordingly.
Then in your main page, DEFAULT, which has the iframe tags, put into your head section...

Code: Select all

<script>
function resizeMe(sFrame,iX,iY) {
	obj = document.all[sFrame].style;
	obj.width = iX;
	obj.height = iY;	
}
</script>
Now I am unsure as to how the child page (your PAGE1 and PAGE2) will react if its not inside of another page, which very well may happen. But try it, and if it gives you an error because it cant find its parent, or the function of its parent, put the 'parent.resizeMe...' code in a try/catch block so it doesn't matter if the page is loaded in an iframe or not. Best of luck.
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
User avatar
fredlongworthhighschool
Mega Advanced
Mega Advanced
Posts: 362
Joined: Fri Jun 27, 2003 11:34 am
Location: Manchester, England.
Contact:

Post by fredlongworthhighschool »

No, didn't work. There was a little bit of scrolling but an error.

I don't know what you mean about 'try/catch' block.

I've uploaded my working code to

http://www.flhs.wigan.sch.uk/v5test/

The page with the frame modifications is in ABOUT..OUR ACCREDITATIONS
Andy Davis
Web Designer & Smartboard Manager

Fred Longworth High School, Manchester, England.
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

Ok first, put that resizeme function declaration in the head of your default.htm page. Thats part of the reason you're getting an error, because accreditations page is trying to find 'resizeMe' and can't. You can put it in there, it wont hurt the other pages that work fine cuz they dont call for it.

A try/catch block is a way in javascript to try to do something and if it errors out, you can catch it so it doesn't cause your whole page to fail. So in your about/accreditations.htm page, put this at the bottom of your page right before the </body>

Code: Select all

<script>
try{
  parent.resizeMe(self.name,document.body.scrollWidth,document.body.scrollHeight);
}catch(e){ //do nothing
}
</script>
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

I see you're already trying some of the changes...occassionally I will refresh and see some stuff. But one thing I noticed, make sure the ID and the NAME of the iframe are the same. Because the frame will pass its name to the function and the function will take that name and try to use it as the ID, so make sure they are the same.
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
User avatar
fredlongworthhighschool
Mega Advanced
Mega Advanced
Posts: 362
Joined: Fri Jun 27, 2003 11:34 am
Location: Manchester, England.
Contact:

Post by fredlongworthhighschool »

Thanks Hergio, I'll give that a try today.
Andy Davis
Web Designer & Smartboard Manager

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

Post by fredlongworthhighschool »

It seems to be working ok offline. But, when I uploaded it to the following url:

http://www.flhs.wigan.sch.uk/v5test/

I've found that the menu bar seems to 'grow'. You can see it if you click refresh.

Ignore the colour scheme, I'm writing a new CSS!
Andy Davis
Web Designer & Smartboard Manager

Fred Longworth High School, Manchester, England.
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

Thats kinda funny looking, but I am sure you are not laughing. I wonder if it has to do with the resizeme call. Try commenting things out in the resizing things to see if you can narrow it down. Besides that, this iframes thing is starting to stump me. I am running dry on ideas (maybe work is stressing me out alittle too).

But you would save yourself a TON of work and frsutration if you started using ASP pages (if you use IIS) or PHP (if you use linux). Includes are the things to use. You could also try using shtml, which allows you to insert things into pages globally. You should do all this because then you can have the one copy included into all your pages only have to maintain in one spot. Definetly consider it. :)
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
User avatar
fredlongworthhighschool
Mega Advanced
Mega Advanced
Posts: 362
Joined: Fri Jun 27, 2003 11:34 am
Location: Manchester, England.
Contact:

Post by fredlongworthhighschool »

It is slightly amusing. If I don't laught at it I'll end up throwing this laptop as far as I can!

I did have a try at juggling some of the settings last night, I'll have a further play.

One good thing is that I have moved the site to a machine running IIS and that showed up the problem. So at least I can work on it without the hassle of uploading.

With this in mind I will give the #INCLUDE method a try again to see if I can get away with not using frames at all.

Thanks again.

Andy

PS........... Fixed it. The reason was down to calling an OVERFILTER in the main menu:

Code: Select all

myfilter = "Alpha(style=0,opacity=80);Shadow(color='#666666', Direction=135, Strength=8)";
overfilter = myfilter;
The problem was the strength variable. Set it higher than 2 and it starts to grow. I thought it controlled the length of the shading.
Andy Davis
Web Designer & Smartboard Manager

Fred Longworth High School, Manchester, England.
User avatar
Hergio
Milonic God
Milonic God
Posts: 1123
Joined: Wed Jun 12, 2002 7:46 pm
Location: Rochester, NY

Post by Hergio »

Wow thats crazy, nice detective work on that Andy! Never woulda thunk it, good to know for future reference. :lol:
Dave Hergert
Software Engineer
"Helping to make the menu better, one :?: at a time."
Post Reply