Author |
Message |
Othic
New Member


Joined: Oct 25, 2003
Posts: 19
|
Posted:
Thu Nov 06, 2003 5:35 pm |
|
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 |
|
|
|
 |
Raven
Site Admin/Owner

Joined: Aug 27, 2002
Posts: 17088
|
Posted:
Thu Nov 06, 2003 6:21 pm |
|
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 thisIf you wanted to create a table you would do something like thisCode: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 inCode: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. |
|
|
|
 |
Othic

|
Posted:
Thu Nov 06, 2003 9:23 pm |
|
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

|
Posted:
Thu Nov 06, 2003 9:28 pm |
|
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

|
Posted:
Thu Nov 06, 2003 9:32 pm |
|
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

|
Posted:
Thu Nov 06, 2003 9:35 pm |
|
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

|
Posted:
Thu Nov 06, 2003 9:38 pm |
|
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

|
Posted:
Thu Nov 06, 2003 9:41 pm |
|
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

|
Posted:
Thu Nov 06, 2003 9:43 pm |
|
|
|
 |
Othic

|
Posted:
Thu Nov 06, 2003 10:09 pm |
|
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  |
|
|
|
 |
Raven

|
Posted:
Thu Nov 06, 2003 10:15 pm |
|
Use the file_get_contents function if you are using php v4.3 or higher. |
|
|
|
 |
Othic

|
Posted:
Thu Nov 06, 2003 10:19 pm |
|
thats it? just file_get_contents and then enter what you want in the block? |
|
|
|
 |
Raven

|
Posted:
Fri Nov 07, 2003 4:52 am |
|
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

|
Posted:
Fri Nov 07, 2003 4:16 pm |
|
Does the url of the site go in the () in file_get_contents? Whats parse, like I said I am new to phpnuke. |
|
|
|
 |
Raven

|
Posted:
Fri Nov 07, 2003 4:27 pm |
|
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

|
Posted:
Fri Nov 07, 2003 4:31 pm |
|
Yeah, I understand, and would like to thank you for all the help you have given me already. |
|
|
|
 |
|