I want to create a page where there are two frame and when we click a link in one page, the main frame detect the change in page and all this in PHP. How can I do this?
Hi haya_360! I’m sorry to say this is not easily possible. PHP is server sided code, therefore anything that happens on the clients screen will not have any affect.
It’s possible you could refresh the sub frame using a javascript call from the main frame but I don’t know much about javascript so I can’t help you much with that aspect.
Another option is the have the main page update a database timestamp on its page load. Then get an AJAX script to constantly monitor this value so that when it changes it refreshes the subframe too. What is the application you had in mind?
There is an “onload” event for frames in a frame set just like the one for a body in a regular HTML document.
In your main page, catch the onload for the second frame and have it reload the main frame or invoke an AJAX call in it to your PHP script.
If you choose to do a complete reload of the main frame, you may want to have the first frame source start out as “about:blank” and let the first load of the second frame load your normal main frame script.
And yes, unless you have a new browser that supports PHP client-side scripting, you will have to use javascript or another local client-scripting language (e.g. VB in IE).
Hi haya_360! I’m sorry to say this is not easily possible. PHP is server sided code, therefore anything that happens on the clients screen will not have any affect.
It’s possible you could refresh the sub frame using a javascript call from the main frame but I don’t know much about javascript so I can’t help you much with that aspect.
Another option is the have the main page update a database timestamp on its page load. Then get an AJAX script to constantly monitor this value so that when it changes it refreshes the subframe too. What is the application you had in mind?
There is an “onload” event for frames in a frame set just like the one for a body in a regular HTML document.
In your main page, catch the onload for the second frame and have it reload the main frame or invoke an AJAX call in it to your PHP script.
If you choose to do a complete reload of the main frame, you may want to have the first frame source start out as “about:blank” and let the first load of the second frame load your normal main frame script.
And yes, unless you have a new browser that supports PHP client-side scripting, you will have to use javascript or another local client-scripting language (e.g. VB in IE).