Jump to content


Photo

php and iframe


  • Please log in to reply
5 replies to this topic

#1 9999

9999
  • Members
  • PipPipPip
  • Advanced Member
  • 99 posts

Posted 09 August 2006 - 05:01 AM

If I have a php file:

<?php

//60 or 70 lines of php code here

?>

How would I put this in an iframe?

I tried the following which didn't work

<iframe src= <?php

//60 or 70 lines of php code here

?>
</iframe>


#2 Jocka

Jocka
  • Members
  • PipPipPip
  • Advanced Member
  • 344 posts
  • LocationDallas, Texas

Posted 09 August 2006 - 05:06 AM

an iframe doesn't hold code, it opens up a seperate outside page. if your looking to put the PHP code in some kind of small, scrollable box, you should look into CSS.

#3 9999

9999
  • Members
  • PipPipPip
  • Advanced Member
  • 99 posts

Posted 09 August 2006 - 05:15 AM

Could I declare the entire php code block a function then put that function name in the src of the iframe

#4 Jocka

Jocka
  • Members
  • PipPipPip
  • Advanced Member
  • 344 posts
  • LocationDallas, Texas

Posted 09 August 2006 - 05:39 AM

No. Try using this code (borrowed from a quick google search)

<div style="width: 300px; height: 300px; overflow: auto; padding: 5px">

     <?php

     //60 or 70 lines of php code here

     ?>

</div>


#5 angelb0y

angelb0y
  • New Members
  • Pip
  • Newbie
  • 5 posts

Posted 09 August 2006 - 09:09 AM

iframe is to my knowledge(which is not alot) used to load a page within a page so it would look something like this

IFRAME File

<iframe src="The page you need to load.php></iframe>


PHP File

<?php The lines of your code in this page ?>



#6 9999

9999
  • Members
  • PipPipPip
  • Advanced Member
  • 99 posts

Posted 09 August 2006 - 05:06 PM

Thank you kindly Jocka.

angelb0y:  Yes, that is the function of the iframe.  What I did was, I took "myphpfile.php" and put that code directly into my "index.php" page so I was not able to call it as I normally would.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users