Link to home
Start Free TrialLog in
Avatar of Simon Cripps
Simon CrippsFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Insert page to template

I have a template created in dreamweaver and would like to insert a forum page that has been created by my service provider.
in the forum page there is a link to my home page.
If I insert the page by iframe then clicking on the link to my home page make the new page includinjg template apear within the origional template, so seeing a template within a template.
If I use PHP "include" the the javascript in the template does not work correctly.
I have tried Frames but these do not appear to work
Any suggestions on how to include an external (forum) page in a template created by dreamweaver.?
Avatar of codeQuantum
codeQuantum
Flag of Canada image

Frames should work. What was the problem with them?
ASKER CERTIFIED SOLUTION
Avatar of msfletch
msfletch
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Simon Cripps

ASKER

<P>This does not appear to work attached is a link to show what is going wrong</P><P><A href="http://www.netballnetball.com/Community/Netball_Forum.html">http://www.netballnetball.com/Community/Netball_Forum.html</A></P><P>if you click on Home in the forum you will see the issue.</P><P>does this help explain the issue</P><P> </P>
Crippsy,

Is there a reason you switched the order of the elements in the last line from:

top.location.href = document.location.href ;

... to:

document.location.href = top.location.href;

That definately won't work. Did you try it both ways?
The way originally written works fine for me. you can test it with the two attached test file codes. Try running it with    onLoad="bustOut();"    in and out of the BODY tag and see the difference.
-------------------------------------------------
test1.htm
-------------------------------------------------
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 
<html>
<head>
	<title>Untitled</title>
 
	<script language="JavaScript" type="text/javascript">
	<!--
	function bustOut() {
	    // check for differences between window location and frame location
	    if (top.location != location) {
	        // make window location same as frame location ... in other words, bust out of frame
	        top.location.href = document.location.href;
		}
	}
	-->
	</script>
 
</head>
 
<body onLoad="bustOut();">
 
<iframe height="200" width="200" frameborder="1" src="test2.htm"></iframe>
 
</body>
</html>
 
-------------------------------------------------
test2.htm
-------------------------------------------------
 
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 
<html>
<head>
	<title>Untitled</title>
</head>
 
<body>
 
<a href="test1.htm">Test Breakout</a>
 
</body>
</html>

Open in new window

yes I was just trying out variations.
As far as I can see the source is now as you suggest but is not working.

OK ... we'll use parent instead of top. Try the following instead. Just include it in the head and forget about the onLoad from the body.
<script language="JavaScript" type="text/javascript">
 
if (parent.frames.length > 0) {
    parent.location.href = self.document.location
}
 
</script>

Open in new window

Narowing this down now.
First of all it did not like onLoad and all had to be lower case onload.
I tried the suggestion above of not using onload an nothing happened
using if (parent.frames.length > 0) {...) keeping the onload made the page continualy refresh

basically still stumped
Interesting about the case. What is the operating system of the sevrer?

Did you try the lower-case "onload" with the "top" code?

When you say it constantly refreshed, do you mean the iFrame refreshed or the age as a whole refreshed?
I'm using 1and 1 so a unix box
I tried onload with the top code
and the whole page refreshed and not just the I frame
That is extremely strange that the code I have given you does not work. I have tested both and they work great on my end, so I am not sure what the difference could be.

One thing is, I looked at your code and I am not sure if what I am seeing is correct, but it seems that you have added the Javascript and the "onload" to the page:

http://www.netballnetball.com/Community/Netball_Forum.html

... but the page that actually opens in the <IFRAME> is:

http://www.netballnetball.com/index.html

The Javascript and onload need to be added to the second page to make them work. Have you tried that?

Another thing that could be causing issues is if the whole site was within a frame to begin with. This does not seem to be the case, but the scripts I gave you check if the opened page is not in the top level of the window (in otherwords not within a frame), and if it is, then it reloads the top level with the URL of the current window. If however, the top level created a frame by default and loaded the home page into that frame, then it would continually refresh the page because it would never be in the top level.

If this were the case, and again looking at the pages it does not seem to be so, then adding the frame breakout to the frameset (as opposed to a page loaded into a frame) would solve the issue. Again, I don't think this is the case, but worth verifying on your end.
You are very good, you got it right first time and explaine dmy error above.
I put the code in the page with the Iframe and not the home page it was calling. it now is it in the home page that is being called and it works.
Many thanks for your patients and apologies for miss reading your solution.
Again many thanks appologies for not seing that the code should go i the page being called and not the calling page. Cheers
Glad you got it working. =)