![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Aug 2005
Posts: 19
Rep Power: 0
![]() |
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. |
|
|
|
|
|
#2 |
|
Programming Guru
![]() Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5
![]() |
You could make the top parent window a PHP script, and have it forward its GET parameters to its child frames.
|
|
|
|
|
|
#3 |
|
Newbie
Join Date: Aug 2005
Posts: 19
Rep Power: 0
![]() |
|
|
|
|
|
|
#4 |
|
Programming Guru
![]() ![]() |
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! |
|
|
|
|
|
#5 |
|
Newbie
Join Date: Aug 2005
Posts: 19
Rep Power: 0
![]() |
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.
|
|
|
|
|
|
#6 |
|
Newbie
Join Date: Aug 2005
Posts: 19
Rep Power: 0
![]() |
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. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| server-infinite loop | programmingnoob | C | 19 | Oct 1st, 2006 10:52 PM |
| C# 2005 - ComboBoxes with Parent / Child relation in DataGridView | jcrcarmo | C# | 0 | Feb 21st, 2006 11:25 PM |
| how to reference parent browser | forumuser | JavaScript and Client-Side Browser Scripting | 6 | Aug 23rd, 2005 1:58 PM |
| Getting parent forms object | Mark67 | Visual Basic | 2 | Jan 14th, 2005 10:38 PM |