Forum Moderators: coopster

Message Too Old, No Replies

access a frame content

         

cody7

4:33 am on May 3, 2005 (gmt 0)

10+ Year Member



Hi,

I have a 2 frame in my page, i will call my left frame as "left_frame" and my right frame as "right_frame"

ok here is my question

here is my code for left.php that resides in the left_frame

<?
$mainUrl = "what will be the correct way of calling the RIGHT FRAME"; // need help in this line
$mainHtml = file_get_contents($mainUrl);
echo "$mainHtml";
?>

my objective here is to print whatever the content of my right_frame, my problem is how can i call my right_frame?...

Thanks for any help or information you can give me...

ironik

4:55 am on May 3, 2005 (gmt 0)

10+ Year Member



PHP isn't aware of frame content. You'll need something client side (javascript) to access content from frames.

What you can do as a work around is tell the page that is loading in the right frame to store data somewhere (in a session or browser cookie) and then when the left page reloads it can find that same data.

Whatever your workaround it isn't going to be elegant. If you need to pass data within different PHP scripts on different frames, then you probably won't want frames at all. If you do want an elegant solution I'd do a search for XMLhttpRequest or XUL. Both methods allow 'client side' access to your server side scripts, but at the cost of complexity.