Forum Moderators: open

Message Too Old, No Replies

Frame that fixes all the issues frames do. Help me make history.

         

t3media

7:51 am on Nov 11, 2005 (gmt 0)

10+ Year Member



I have a site that is in a frame... I hated the fact that when someone pulled out the main page it forced duble url's... Http"//mysite.com/index.php?http://mysite.com/stuff/what_was_really_needed.php

I have the standard if self isnt self goto main index java checker...

So I put this together... IT ACTUALLY WORKS... but is messy. I need help. I see javascript errors...

I see dead people...
I need help.

Calgon take me away.


<script language="JavaScript">
title = document.title
if (top.location == self.location)
passpage = document.url
document.write("<title>" + title + "</title>");
document.write('<frameset rows="90,100%,26" border="0" frameborder="0" framespacing="0"><frame name="topnav" src="$vboptions[bburl]/pull.php?do=header" noresize scrolling="no"><frame src=\"' + passpage + '\" name="main_win" noresize><frame name="bottomnav" src="$vboptions[bburl]/pull.php?do=footer" noresize scrolling="no"><\/frameset> ')
document.write("<title>" + title + "</title>");
</script>

kaled

11:07 am on Nov 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



This is my version. I wrote this about 18 months ago.
The top frame is 52 pixels high.
I have a three frame version too.
I use <iframe> when javascript is disabled.


// This script should be called at the end of the html <HEAD>

function cached() // true if in Google, Yahoo or MSN cache
{ var s = document.location.pathname;

return (s.indexOf("/search") >= 0) ¦¦ (s.indexOf("/cache") >= 0);
};

function writeFrames(s)
{ with (document) {
writeln('<frameset border="0" rows="52,*">');
writeln(' <frame src="top.html" name="fr_top" noresize marginwidth="0" marginheight="0" scrolling="no">');
writeln(' <frame src="' + s + '" name="fr_main" noresize marginwidth="0" marginheight="0">');
}}

function createFrames()
{ if (cached()) return false;

with (document) {
var s = location.href;

var h = '';
var i = s.indexOf('#');
if (i > 0) {
h = s.substr(i);
s = s.substr(0,i);
}

if (s.indexOf('?') < 0) s = s + '?'; else s = s + '&';
s = s + 'frameload=1'; // essential that different url is loaded into content frame

if (h) s = s + h;

open();

writeln('</head>');

writeFrames(s);

writeln('<noframes><body>Frames required.</body></noframes></frameset></html>');

close();
}};

if (top == self) createFrames();// else focus();

Kaled.

t3media

3:03 pm on Nov 11, 2005 (gmt 0)

10+ Year Member



nice action... so to add three I can just do a new section in the writeframe(s) area.... God knows my version works but Eaahuuahhh... Needa fix. So you belive iframes are better?

kaled

5:14 pm on Nov 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I use a fairly complex template. If javascript is enabled, frames are used. However, if javascript is disabled, top.html is loaded into an <iframe>. The page looks and works the same way however, the top navigation area scrolls with the remainder of the content.

Kaled.

bcc1234

5:15 pm on Nov 11, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



main index java checker...

One off-topic suggestion.

Before you jump in to make history, please make sure you know the difference between java and javascript :)

t3media

5:47 am on Nov 12, 2005 (gmt 0)

10+ Year Member



Do you mind sharing it? If not I understand...

DrDoc

9:50 pm on Nov 12, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Do you mind sharing it? If not I understand...

Share what?

kaled

11:48 am on Nov 14, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I think t3m would like to see my template stuff. It's a little hairy but here goes......

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> 
<html>
<!--
The doctype url has been omitted to prevent the display of a horizontal scrollbar in js/frames mode (IE).
The correct url is "http://www.w3.org/TR/html4/loose.dtd".
-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<base target="_top">
<link rel="stylesheet" type="text/css" href="std.css">
<!-- TemplateBeginEditable name="title, etc" -->
<title>Untitled Document</title>
<!-- TemplateEndEditable -->
<script src="../frames_2h.js" type="text/javascript"></script>
<!-- TemplateParam name="sitelinks" type="boolean" value="false" -->
</head>

<body>
<noscript>
<div id="banner">
<iframe
src="top.html"
height="52" width="100%" marginheight="0" marginwidth="0" scrolling="no" frameborder="0">
<p style="background-color:#FFFF80; padding:4px">&nbsp;<!-- js or iframes required for nav bar--></p><br>
</iframe>
</div>
</noscript>

<div id="body">
<p id="toplinks"><a href="index.html"><!-- TemplateBeginEditable name="body - homelink" -->home<!-- TemplateEndEditable --></a></p>

<h1 style="white-space:nowrap"><!-- TemplateBeginEditable name="body - title" -->page title<!-- TemplateEndEditable --></h1>

<!-- TemplateBeginEditable name="body - main" -->main content<!-- TemplateEndEditable -->

<!-- TemplateBeginIf cond="_document['sitelinks']" -->
<h4>Links</h4>
<div class="sitelinks">
-- edited for webmasterworld --
</div>
<!-- TemplateEndIf -->

</div>
</body>
</html>

It could be tidier but it works.

Kaled.