Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff
Author Message
Othic
New Member
New Member



Joined: Oct 25, 2003
Posts: 19

PostPosted: Thu Nov 06, 2003 5:35 pm Reply with quote

Whats the code for iframes in php? Also is it possible to set where the iframe covers? So like it only shows one part, and you can't scroll. Thanks
 
View user's profile Send private message
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Thu Nov 06, 2003 6:21 pm Reply with quote

PHP is a server side scripting language. It performs various functions, connecting to servers, databases, networkings, and a whole lot more. But, to send any output to the browser, it must send HTML, JavaScript, CSS, etc., all browser stuff, if you will.

So, there is no "code" for iframes in PHP. iframes are just HTML tags. If you wanted to send a statement to the browser from PHP, you would do something like this
Code:
echo "Hello World";
If you wanted to create a table you would do something like this
Code:
echo "<table><tr><td>Hello World</td></tr></table>";
So, to send an iframe from PHP to your browser, you would code it first in HTML and then "wrap" it in an echo tag as in
Code:
echo "<iframe frameborder=\"0\" src=\"modules/some_module/index.php?is_admin=$is_admin&adminName=$adminName\" width=\"100%\" height=\"200\"><ilayer  src=\"modules/some_module/index.php?is_admin=$is_admin&adminName=$adminName\" width=\"100%\" height=\"200\"></ilayer></iframe>";
I am passing PHP variables in that statement. But, PHP wil translate their values BEFORE sending it to the browser. The olayer is for Netscape and is ignored by IE as Netscape ignores the iframe tag. For the syntax of the iframe tag, there are many good references on the 'net.

As to positioning, if you add the code to a block then it will appear wherever the block appears.
 
View user's profile Send private message
Othic







PostPosted: Thu Nov 06, 2003 9:23 pm Reply with quote

Cool thanks for the help, but i think you mis understood the second part of my question, how you postition the area that the iframe covers, in the block.
 
Raven







PostPosted: Thu Nov 06, 2003 9:28 pm Reply with quote

Still not sure if I understand. A block is a table. If you were designing this in a standard HTML table, however you would position it will be the same way you position it in the block. Does that answer your question?
 
Othic







PostPosted: Thu Nov 06, 2003 9:32 pm Reply with quote

Still not there. I think I can explain this a bit better. How would you position the iframe so it only shows a certain part of the site? Like if I only wanted a bit of info in the block, and I used an iframe is there a way to position the iframe so it only shows the parts of the site I want it to?
 
Raven







PostPosted: Thu Nov 06, 2003 9:35 pm Reply with quote

Not really. If you are trying to harvest another site then you will need to do something like a $site = file_get_contents(SITE_URL) and then parse $site for the pieces you want.


Last edited by Raven on Thu Nov 06, 2003 9:39 pm; edited 1 time in total 
Othic







PostPosted: Thu Nov 06, 2003 9:38 pm Reply with quote

Ok, well this isn't exactly the kind of news I wanted to hear lol, I was hoping I could keep it simple and just use an iframe, but I will try what you said. I think I know what you are talking about, I think I could use the last_referres block as a reference to see what I need to do, is that a good thing to use to help me? I am very new to phpnuke or php for that matter.
 
Raven







PostPosted: Thu Nov 06, 2003 9:41 pm Reply with quote

No, that doesn't do what you need. Download my Stock Quotes application for a detailed use of the method I employ. Search for file_get_contents.
 
Othic







PostPosted: Thu Nov 06, 2003 9:43 pm Reply with quote

Ok thanks for the help
 
Othic







PostPosted: Thu Nov 06, 2003 10:09 pm Reply with quote

So would the code look something like this?

?>

Not including the stuff here that is needed

$readf = @file("urlhere")
then put the stuff here that the block is looking for

Not sure if this is correct Confused
 
Raven







PostPosted: Thu Nov 06, 2003 10:15 pm Reply with quote

Use the file_get_contents function if you are using php v4.3 or higher.
 
Othic







PostPosted: Thu Nov 06, 2003 10:19 pm Reply with quote

thats it? just file_get_contents and then enter what you want in the block?
 
Raven







PostPosted: Fri Nov 07, 2003 4:52 am Reply with quote

As I said, look at my code. file_get_contents() retrieves the page. Then you need to parse it to extract the pieces you want. In essence you then build a page from the pieces. Then, there's really no need of an iframe. Just display the page, but that's up to you.
 
Othic







PostPosted: Fri Nov 07, 2003 4:16 pm Reply with quote

Does the url of the site go in the () in file_get_contents? Whats parse, like I said I am new to phpnuke.
 
Raven







PostPosted: Fri Nov 07, 2003 4:27 pm Reply with quote

http://us2.php.net/manual/en/function.file-get-contents.php

Please understand that while I would like to help everyone here with their questions, time and space does not allow me to do that. I would recommend that you get a good book on PHP and MySQL as those will be used together more than anything else. Use the on-line php manual at http://php.net . You might also want to pick up a book on programming in general to become used to the terms. When you 'parse' something, you break it into components or pieces. So, if you had a line of text like
$text = 'Now is the time for all good men to come to the aid of their country.";
and you needed to find the position of the word 'good', you would parse the string $text using various string handling functions of PHP http://us4.php.net/manual/en/ref.strings.php possibly using stripos().
 
Othic







PostPosted: Fri Nov 07, 2003 4:31 pm Reply with quote

Yeah, I understand, and would like to thank you for all the help you have given me already.
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©