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
Probllem with PHP and IFrame
Moderator: General Moderators
- aerodromoi
- Forum Contributor
- Posts: 230
- Joined: Sun May 07, 2006 5:21 am
Re: Probllem with PHP and IFrame
Looks like a variable got mixed up.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
Code: Select all
if (empty($script)) $answer= $guess;Sorry. here is the code ...
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!
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");
}
}- aerodromoi
- Forum Contributor
- Posts: 230
- Joined: Sun May 07, 2006 5:21 am
Right now the only thing I see is: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
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
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 :
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 ...
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 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 ...
- aerodromoi
- Forum Contributor
- Posts: 230
- Joined: Sun May 07, 2006 5:21 am
Sorry, but that doesn't yet make sense to memzfp2 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 :
If I place this in a script and is called directly from the address bar of my browser, it will work fine.Code: Select all
print "<iframe src='http://someurl.com' width='200' height='200'></iframe>
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 ...
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