Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Nov 7th, 2006, 9:43 AM   #1
drumltd
Newbie
 
Join Date: Aug 2005
Posts: 19
Rep Power: 0 drumltd is on a distinguished road
Parent URL

I know that I can use _GET and _POST etc. to get variables that are passed to a file etc. when it's displayed. However if the php script is called from with in a frame these only return the variables passed to the frame (as expected)

Is there anyway of getting either the url or params from the top most parent window??

Cheers

Dave.
drumltd is offline   Reply With Quote
Old Nov 7th, 2006, 9:50 AM   #2
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5 Arevos is on a distinguished road
You could make the top parent window a PHP script, and have it forward its GET parameters to its child frames.
Arevos is offline   Reply With Quote
Old Nov 7th, 2006, 10:40 AM   #3
drumltd
Newbie
 
Join Date: Aug 2005
Posts: 19
Rep Power: 0 drumltd is on a distinguished road
Quote:
Originally Posted by Arevos View Post
You could make the top parent window a PHP script, and have it forward its GET parameters to its child frames.
Unfortunately I don't have full control of the parent URL, (it's part of a system)
drumltd is offline   Reply With Quote
Old Nov 7th, 2006, 11:07 AM   #4
Pizentios
Programming Guru
 
Pizentios's Avatar
 
Join Date: May 2004
Location: Brandon, Manitoba, Canada
Posts: 2,023
Rep Power: 7 Pizentios is on a distinguished road
Send a message via ICQ to Pizentios Send a message via MSN to Pizentios
you could try a javascript php combo.

a while back i had to get arrays from inside a javascript to php, i ended up doing it with some code i got off the php mailing list.

the thread can be found here: http://www.programmingforums.org/for...pt-arrays.html

you could probably pass the varibles that you want by using javascript to grab the values from the parent window. Just an idea.
__________________
Profanity is the one language that all programmers understand.

Check out my Blog <---updated Nov 30 2007!
Pizentios is offline   Reply With Quote
Old Nov 7th, 2006, 1:09 PM   #5
drumltd
Newbie
 
Join Date: Aug 2005
Posts: 19
Rep Power: 0 drumltd is on a distinguished road
Now you've mentioned Javascript I've had a poke around, and my idea is to have a javascript that gets the params, then adds them to the php script url and displays it, however my Javascripts isn't really upto going that. Guess it's time for a web search and start reading.
drumltd is offline   Reply With Quote
Old Nov 7th, 2006, 2:56 PM   #6
drumltd
Newbie
 
Join Date: Aug 2005
Posts: 19
Rep Power: 0 drumltd is on a distinguished road
Well I've googled, read, and written.

I've written a little, javascript that takes a page as a parameter, and passes both it's and any parent params to it. Think it'll be fairly self how it works, cos it's the first js I've written, but just ask if anybody wants any explanations, or more likely tell me what I've done wrong.

<script>

stHref = top.location.href;
TopParamString = stHref.substr(stHref.indexOf("?")+1);

stHref = window.location.href;
ParamString = stHref.substr(stHref.indexOf("?")+1);

ParamArray = ParamString.split("&");
for ( var iParam = 0; iParam < ParamArray.length; iParam++ )
{
   if (ParamArray[iParam].indexOf("page=") > -1 )
    {   aValue = ParamArray[iParam].split("=");
        if (ParamString == TopParamString)
           window.location.href = aValue[1] + "?" + ParamString;
        else
           window.location.href = aValue[1] + "?" + ParamString + "&" + TopParamString;
    }
}

</script>

Hope it helps someone else.
drumltd is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
server-infinite loop programmingnoob C 19 Oct 1st, 2006 11:52 PM
C# 2005 - ComboBoxes with Parent / Child relation in DataGridView jcrcarmo C# 0 Feb 22nd, 2006 12:25 AM
how to reference parent browser forumuser JavaScript and Client-Side Browser Scripting 6 Aug 23rd, 2005 2:58 PM
Getting parent forms object Mark67 Visual Basic 2 Jan 14th, 2005 11:38 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 7:22 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC