faqts : Computers : Programming : Languages : PHP

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

59 of 116 people (51%) answered Yes
Recently 5 of 10 people (50%) answered Yes

Entry

How do I handle frames & window openings in PHP, for instance if I have a frames page & I want to eliminate the frames, how do I do this using PHP ?
I seem to have the same problem. I dont want to use frames but i want my news blog to open in a sect

May 12th, 2008 21:31
dman, i can do it, ha mo, Paul Coldrey, Mahesh K, Julius Pratt, http://www.ttnr.org


The problem you are facing is that frames are a client-side entity and 
PHP is a server-side language. No information about the frame layout is 
passed to the server because the frames are fully implemented in the 
browser (with each frame really acting as a full-blown browser window). 
Hence the only way to deal with frames from the server is to target the 
top-most window/frame of the set you wish to change and redraw all its 
child windows. There may be some neat way to make the top frame the 
target using the header(...) function (but I don't know it). Your other 
option is to send some JavaScript with the page and use it to rearrange 
the frames (since it is client-side it can manipulate the frames inside 
the browser).
Here is the javascript code to break out of frames,
if(top.location != self.location)
{
  top.location.replace(self.location);
}