Reply
Reload to frames...keep the right main page
Old 11-16-2002, 08:16 AM Reload to frames...keep the right main page
DaveTodd's Avatar
Evil Psycho Alien

Posts: 684
Location: Sheffield, England
A dilemma has occurred while i am trying to impliment a "recommend this page to a friend" script on safariquip. the main page is fine, because i can use the script...

<script language="JavaScript">
if(!(parent.frames.length > 0))
{
window.location.href = '../../index.php';
}
</script>

to reload the page into the main page, with menu etc.

the problem occurs when i get to things like the competitions page. i need to be able to send the url for the competitions page...and then when people visit it, for the main frame that will be shown to reload into the frames page, so that the top bar and menu appear, but KEEP the competitions page as the main frame.

this has me stumped, i don't have a script to do it. does anyone have a script that would work? it would be most appreciated if someone knows how to do it!

many thankx
__________________
take care,
Dave ;)
SafariQuip - Mosquito Nets, Travel + Safari Equipment Online
DaveTodd is offline
Reply With Quote
View Public Profile
 
When You Register, These Ads Go Away!
     
Old 11-17-2002, 12:55 PM
dk01's Avatar
Ultra Talker

Posts: 373
Location: Ames, IA
Ok basically since you don't have php capability I would suggest using something called the QueryString. It is the part of a url that looks like this normally:
?myvariable=somevalue&variable2=value2

Basically what you want is for you to be able to pass a page address to your frames page and then have the frames page open that page in your "content" frame.

If you replace your frames page (frames.html) with the attached update of your frames page then it should work (however I have not tested it, leave that to you) and then change the:
====================================
<script language="JavaScript">
if(!(parent.frames.length > 0))
{
window.location.href = '../../index.php';
}
</script>
====================================

on your pages to:

====================================
<script language="JavaScript">
if(!(parent.frames.length > 0))
{
window.location.href = "http://www.safariquip.co.uk/vivid/frames.html&url="+ window.location.href;
}
</script>
====================================


Let me know if all that works I think it should.
-dk
Attached Files
File Type: txt frames.txt (8.1 KB, 13 views)
__________________
Did I help you? If so, be nice and throw me some TP
dk01 is offline
Reply With Quote
View Public Profile Visit dk01's homepage!
 
Old 11-21-2002, 02:39 PM
Novice Talker

Posts: 12
Location: Kenya, Africa
Tood,
all you need is to go to the link code and add this tag <target="main"> an this will automatically put the page in the right frame hence showing all you want to show. First gert the javascript out and practice with this tag then if it work for you you can enhance it with the script but all you need is that tag to target it to main (right frame).
Hope this helps.
wambui is offline
Reply With Quote
View Public Profile
 
Old 11-21-2002, 03:43 PM
dk01's Avatar
Ultra Talker

Posts: 373
Location: Ames, IA
wambui what Todd was asking is how he can refer to a page (http://www.safariquip.com/mypage.html for example) from a separate webpage and have the frameset load the page (http://www.safariquip.com/mypage.html) into the right frame of his site.
I think what you are refering to is if he was trying to create a link from inside his own site.
-dk
__________________
Did I help you? If so, be nice and throw me some TP
dk01 is offline
Reply With Quote
View Public Profile Visit dk01's homepage!
 
Old 11-21-2002, 04:04 PM
Novice Talker

Posts: 12
Location: Kenya, Africa
Either way the idea is to have that page targeted to main. an this will bring this page in his right frame.< a href='htp://www...." target="main"> Try it.
Hope this helps
wambui is offline
Reply With Quote
View Public Profile
 
Old 11-22-2002, 02:45 AM
dk01's Avatar
Ultra Talker

Posts: 373
Location: Ames, IA
Unfourtunately it is not that simple. Because if he gives the user a link to a page in an email (lets say http://www.safariquip.com/mypage.html), he cannot give a target referring to a frame non-existant. If you re-read his original post or maybe try looking at his site then you will see that he is not asking for help with target="blah... but rather with a more complex issue.
-dk
__________________
Did I help you? If so, be nice and throw me some TP
dk01 is offline
Reply With Quote
View Public Profile Visit dk01's homepage!
 
Old 12-07-2002, 06:21 AM
DaveTodd's Avatar
Evil Psycho Alien

Posts: 684
Location: Sheffield, England
Okay....i've tried that....and unfortunately it didn't work
I replaced the frames page with the new one...visible at http://www.safariquip.co.uk/
I added in the snippet of code to the competition page, so i could check it, visible at http://www.safariquip.co.uk/vivid/pages/comp/comp.html

I checked it by going straight to the competition page, so that it would reload to the main frames page but keep the comp page in the frames....and no joy. It just gives me a 404 error page.

========================================

The script in the frames page looks like this :

</frameset>
</frameset>

<script language="javascript">
function getArgs() {
var args = new Object();
// Get Query String
var query = location.search.substring(1);
// Split query at the comma
var pairs = query.split("&");

// Begin loop through the querystring
for(var i = 0; i < pairs.length; i++) {

// Look for "name=value"
var pos = pairs[i].indexOf('=');
// if not found, skip to next
if (pos == -1) continue;
// Extract the name
var argname = pairs[i].substring(0,pos);

// Extract the value
var value = pairs[i].substring(pos+1);
// Store as a property
args[argname] = unescape(value);
}
return args; // Return the Object
}
var args = getArgs(); //Get the arguments

if(args.url)
{
window.content.location.href = args.url;
}
</script>

<noframes>
<body bgcolor="#FFFFFF" text="#000000">
<h1><font size="2">Travel Equipment and Safari Equipment suppliers to all over
the world!! </font></h1>

Thats a snippet so you know where abouts it lies etc.

=========================================

The script on the competition page is like this :

<script language="JavaScript">
if(!(parent.frames.length > 0))
{
window.location.href = "http://www.safariquip.co.uk/vivid/frames.html&url="+ window.location.href;
}
</script>

========================================

Is there an error with either one of these codes? you can view the pages and see the errors etc by going to http://www.safariquip.co.uk/vivid/pages/comp/comp.html
That should help...

Anyone that can help solve this problem, please let me know how!!
__________________
take care,
Dave ;)
SafariQuip - Mosquito Nets, Travel + Safari Equipment Online
DaveTodd is offline
Reply With Quote
View Public Profile
 
Old 12-07-2002, 08:50 AM
dk01's Avatar
Ultra Talker

Posts: 373
Location: Ames, IA
Ahhh my bad! Well i just noticed that this:
<script language="JavaScript">
if(!(parent.frames.length > 0))
{
window.location.href = "http://www.safariquip.co.uk/vivid/frames.html&url="+ window.location.href;
}
</script>



should be this:



<script language="JavaScript">
if(!(parent.frames.length > 0))
{
window.location.href = "http://www.safariquip.co.uk/vivid/frames.html?url="+ window.location.href;
}
</script>




Hope it works. I have my fingers crossed.
-dk
__________________
Did I help you? If so, be nice and throw me some TP
dk01 is offline
Reply With Quote
View Public Profile Visit dk01's homepage!
 
Old 12-07-2002, 10:14 AM
DaveTodd's Avatar
Evil Psycho Alien

Posts: 684
Location: Sheffield, England
okay...i've tried implimenting that.

it works...to an extent. it works just how the old script did. it reloads back to the frames pages, but reloads the main frame as the default main frame rather than the competition page.

there must be something amiss somewhere. i need it to reload to the frames page but keep the page from which it comes as the main frame in the page. so basically load up the menu and top frames.

any ideas?
__________________
take care,
Dave ;)
SafariQuip - Mosquito Nets, Travel + Safari Equipment Online
DaveTodd is offline
Reply With Quote
View Public Profile
 
Old 12-08-2002, 04:16 AM
dk01's Avatar
Ultra Talker

Posts: 373
Location: Ames, IA
Ya i get what you are trying to do but my script must have some sort of error in it... hmmm.. I am going to download that pages and test it locally. Let you know if I get anywhere.
-dk
__________________
Did I help you? If so, be nice and throw me some TP
dk01 is offline
Reply With Quote
View Public Profile Visit dk01's homepage!
 
Old 12-08-2002, 05:51 AM
dk01's Avatar
Ultra Talker

Posts: 373
Location: Ames, IA
Ok! Got it now. Just had too change a few things in the code.
Here is the new code which should be inside the < head> of your frames.html:
============================
<script language="javascript">
function getArgs()
{
var args = new Object();

// Get Query String
var query = location.search.substring(1);

// Split query at the comma
var pairs = query.split("&");

// Begin loop through the querystring
for(var i = 0; i < pairs.length; i++) {

// Look for "name=value"
var pos = pairs[i].indexOf('=');

// if not found, skip to next
if (pos == -1) continue;

// Extract the name
var argname = pairs[i].substring(0,pos);

// Extract the value
var value = pairs[i].substring(pos+1);

// Store as a property
args[argname] = unescape(value);

}

return args; // Return the Object
}

function framizer() {
var arg = getArgs(); // Get the arguments

if(arg.url) {
main.location.href = arg.url;
}

}

function nsCapture()
{
if((!document.all && document.getElementById) || document.layers)
{
document.captureEvents(Event.ONLOAD);
}
}
nsCapture();
onload = framizer;
</script>

========================

and this should be the code in the < head> of the normal framed pages (comp.html):

========================
<script language="JavaScript">
if(!(parent.frames.length > 0))
{
window.location.href = "http://www.safariquip.co.uk/vivid/frames.html?url="+ window.location.href;
}
</script>


===============================
Let me know if you have any more probs. I have tested it in IE5+ and NS6. It should work with NS4 also but I cant be sure about mozilla or opera.
-dk
__________________
Did I help you? If so, be nice and throw me some TP
dk01 is offline
Reply With Quote
View Public Profile Visit dk01's homepage!
 
Old 12-14-2002, 05:22 AM
DaveTodd's Avatar
Evil Psycho Alien

Posts: 684
Location: Sheffield, England
okay, i've implimented the new codes...and still no joy i'm afraid.

if i've got it wrong somewhere let me know, i've put the scripts into the head section of http://www.safariquip.co.uk/vivid/frames.html

and into the head section of http://www.safariquip.co.uk/vivid/pages/comp/comp.html

going to the competition page on its own reloads the page back to the main page. the frames appear, but the main frame is still the original front main frame rather than the competitions page main frame.

is there a bug still or is it something i've done thats caused the problem? any help would be much appreciated!!

thankx in advance...
__________________
take care,
Dave ;)
SafariQuip - Mosquito Nets, Travel + Safari Equipment Online
DaveTodd is offline
Reply With Quote
View Public Profile
 
Old 12-14-2002, 07:50 PM
dk01's Avatar
Ultra Talker

Posts: 373
Location: Ames, IA
Ahh its cuz of this line i think:

if(arg.url) {
main.location.href = arg.url;
}


Change it to this (since your frame is named 'content':

if(arg.url) {
content.location.href = arg.url;
}

-dk
__________________
Did I help you? If so, be nice and throw me some TP
dk01 is offline
Reply With Quote
View Public Profile Visit dk01's homepage!
 
Old 12-21-2002, 05:16 AM
DaveTodd's Avatar
Evil Psycho Alien

Posts: 684
Location: Sheffield, England
okay, i've implimented the last code change, and still no joy!!

its still loading the original main frame instead of the competitions page.

the pages are available at the following URLs

http://www.safariquip.co.uk/vivid/frames.html
http://www.safariquip.co.uk/vivid/pages/comp/comp.html

please let me know of any other changes that need to be made. we must have almost got this cracked now!!

many thankx
__________________
take care,
Dave ;)
SafariQuip - Mosquito Nets, Travel + Safari Equipment Online
DaveTodd is offline
Reply With Quote
View Public Profile
 
Old 12-30-2002, 04:37 AM
DaveTodd's Avatar
Evil Psycho Alien

Posts: 684
Location: Sheffield, England
okay...

i found the problem, the page loads first to the main page, then, when that page is completely loaded, it then loads the competition page into the main frame. I wasn't giving it enough time to load and then reload.

This however causes a little bit of a problem. People won't stick around if the wrong page loads for them, they'll assume a wrong link, and most likely leave.

Is there any way (i'm thinking php is probably the best way) of getting the competition page to load straight off instead of main page -> competition page?

It's almost sorted now, its just a matter of speed...

Many thanks for your continued help
__________________
take care,
Dave ;)
SafariQuip - Mosquito Nets, Travel + Safari Equipment Online
DaveTodd is offline
Reply With Quote
View Public Profile
 
Old 12-30-2002, 01:45 PM
dk01's Avatar
Ultra Talker

Posts: 373
Location: Ames, IA
Ok I have an idea. Try replacing this:
----------

function nsCapture()
{
if((!document.all && document.getElementById) || document.layers)
{
document.captureEvents(Event.ONLOAD);
}
}
nsCapture();
onload = framizer;

-------
With this:
--------

framizer();

---------

And then move the whole script tag down the page. So...
</FRAMESET>
<--- Put script in there.
<NOFRAMES>

If that doesn't work then php might be the best way to do it. Frustrating eh?
-dk
__________________
Did I help you? If so, be nice and throw me some TP
dk01 is offline
Reply With Quote
View Public Profile Visit dk01's homepage!
 
Old 01-02-2003, 06:03 AM
DaveTodd's Avatar
Evil Psycho Alien

Posts: 684
Location: Sheffield, England
no joy i'm afraid.

we've pushed this script as far as we can i think. possibly best to go for a complete rewrite or move to php.

i'll make a new thread requesting the same operation in php, perhaps i'll get lucky. executing server side might be faster anyways.

thanks for all your help
__________________
take care,
Dave ;)
SafariQuip - Mosquito Nets, Travel + Safari Equipment Online
DaveTodd is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Reload to frames...keep the right main page
 

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML

 


Page generated in 0.23581 seconds with 14 queries