Re: forced framing of php page
| From: | Mark Rogers | Date: | Tue, 05 Dec 2000 17:44:11 +0000 |
| Subject: | Re: forced framing of php page | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-28729@lists.php.net to get a copy of this message | ||
David Tod Sigafoos wrote:
>
> I believe that you will have to do this type of check with javascript.
>
> PHP just works with vars that are available at the server
This is correct, since the web server (and therefore PHP) does not know that
the URL you have just requested is going to be used inside a frame.
PHP can be used to simplify the Javascript, though. What I have done in the
past is to maintain a session array variable, $frames, within which I keep
the URL of the page opened in each frameset. This means that index.htm (or
whatever file defines your frameset) can be written to put the right page
into each frame - eg after a refresh. When a page is opened, it simply needs
JavaScript to (a) update $frames, (b) determine whether index.htm is part of
its URL, and (c) if it isn't, redirect to index.htm - which will now know
which page to open in which frame.
The alternative is usually to pass the name of the page being opened as a
parameter to index.htm, which works, but does not survive a refresh.
Unfortunately I don't have any sample code for this to hand, but the hardest
part is the JavaScript which you (ie Chris) already have anyway.
Remember that sessions require PHP v4, of-course.
--
Mark Rogers
Remove the .news to reply by mail.