Page 1 of 1
Probllem with PHP and IFrame
Posted: Sun Jun 04, 2006 10:46 am
by mzfp2
Hi,
I am using a template based framework to interface my PHP scripts with HTML output, but have recently run into a problem which I cannot solve.
Normally my PHP templarte scripts will read a template file, and output appropriate content, however I have a function in my code, which calls the output function, the file it should siplay contains an IFRAME, and regardless of irts src property, it only ever displays the host page, soo I get like a recursive effect of Iframes loading into themselves,
I have tried using ob_flush, flush and even Header redirect, but it doesn't seem to workk :
Hope the above makes sense.
Kind Regards
Re: Probllem with PHP and IFrame
Posted: Sun Jun 04, 2006 10:58 am
by aerodromoi
mzfp2 wrote:Hi,
I am using a template based framework to interface my PHP scripts with HTML output, but have recently run into a problem which I cannot solve.
Normally my PHP templarte scripts will read a template file, and output appropriate content, however I have a function in my code, which calls the output function, the file it should siplay contains an IFRAME, and regardless of irts src property, it only ever displays the host page, soo I get like a recursive effect of Iframes loading into themselves,
I have tried using ob_flush, flush and even Header redirect, but it doesn't seem to workk :
Hope the above makes sense.
Kind Regards
Looks like a variable got mixed up.
Code: Select all
if (empty($script)) $answer= $guess;
aerodromoi
Posted: Sun Jun 04, 2006 11:05 am
by mzfp2
Sorry. here is the code ...
Code: Select all
Function ProfileUpdate()
{
$Table = New DataInterface();
$str_Query = "SELECT * FROM users_pending
WHERE username LIKE '$username'
AND activated LIKE '1'
";
$Table->DoQuery($str_Query);
$row = mysql_fetch_array($Table->result);
if (mysql_num_rows($Table->result) <= 0) return false;
else
{
//Redirect('',"$server_name/db/interface/registra.php?Action=ProfileContinue");
header("Location: http://myhost/db/interface/registra.php?Action=ProfileContinue");
}
}
Registra.php loads the template for updating the profile, this usually works fine, but because I am calling thhe function within the script, it seems to be upsetting the IFRame that is in the template!
Posted: Sun Jun 04, 2006 11:07 am
by mzfp2
I also forgot too mention that if type the address above direct the address bar
myhost/db/interface/registra.php?Action=ProfileContinue
Things work ok
Posted: Sun Jun 04, 2006 11:24 am
by aerodromoi
mzfp2 wrote:I also forgot too mention that if type the address above direct the address bar
myhost/db/interface/registra.php?Action=ProfileContinue
Things work ok
Right now the only thing I see is:
Parse error: parse error, unexpected $ in /home/alljammcom/public_html/db/interface/registra.php on line 140
What's the code for the Iframe itself?
aerodromoi
Posted: Sun Jun 04, 2006 11:30 am
by mzfp2
Hi
many thanks for your reply, the error is due to me mucking about with the script.
I have managed to narrow down the problem to a very specific line of code :
Code: Select all
print "<iframe src='http://someurl.com' width='200' height='200'></iframe>
If I place this in a script and is called directly from the address bar of my browser, it will work fine.
If however I call it from another script (I call the function containing that code) it will fail to load the src, instead it loads the current page within itself
I hope that helps ...
Posted: Sun Jun 04, 2006 1:02 pm
by aerodromoi
mzfp2 wrote:Hi
many thanks for your reply, the error is due to me mucking about with the script.
I have managed to narrow down the problem to a very specific line of code :
Code: Select all
print "<iframe src='http://someurl.com' width='200' height='200'></iframe>
If I place this in a script and is called directly from the address bar of my browser, it will work fine.
If however I call it from another script (I call the function containing that code) it will fail to load the src, instead it loads the current page within itself
I hope that helps ...
Sorry, but that doesn't yet make sense to me

You've got a function which prints out the string posted above (btw: you should close the string/the print function as well).
As the url is hardcoded into the string the error must be somewhere else.
aerodromoi