Re: Really basic PHP questions -- newbie here!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ellen Heitman wrote:

> Hello! I would really appreciate some answers to a few basic questions.
> I have done some research online, but it would greatly help me to get
> direct answers.
> 1. If my site needs to be available to many browsers, including those
> that may not be entirely up-to-date, is PHP a safe option? I mean, I
> know that Flash is something people have to have enabled on their
> browsers, but I thought I read that PHP is available to all recent
> browsers as long as the server the site is hosted on supports PHP. Is
> this true?

No, and it's not even wrong, either ;)

PHP is a programming language. You use it to create programs (more 
commonly called scripts) that run on a web server. When a script is 
requested by a browser, the PHP interpreter on the server runs the script 
and only the result is sent back to the browser.

This is a PHP script:

    <?php
    for(i = 0; i < 5; i++)
        echo "<p>Hello world!</p>\n";
    ?>

This is what it looks like to the browser:

    <p>Hello world!</p>
    <p>Hello world!</p>
    <p>Hello world!</p>
    <p>Hello world!</p>
    <p>Hello world!</p>

There is no need for a browser of any generation to understand PHP, 
because it will never get to see it. Of course, as the PHP programmer you 
must make sure that your scripts' output can be handled by the intended 
clients.

> 2. How can I preview my PHP while I'm coding? I'm using TextWrangler. I
> have already followed the installation tutorial here:
> http://foundationphp.com/tutorials/php_leopard.php. The test PHP file
> does work in my Safari browser. However, when I try to preview my .php
> files created in TextWrangler with Safari it doesn't work.

You need to put your PHP files in the web server's home directory, 
probably the same folder where you placed the test file from that 
article, and access them through http. That would look like

<http://localhost/yourscript.php>

> 3. I need something that functions as an iframe. I've been reading that
> include() serves this purpose.

No. Completely different things.

> However, I've found that I have the make
> the content in the "iframe" the main content and call the things around
> it. I want to do the reverse. I want the other content on the main html
> page in place, and just want to call the text in the frame box. Is this
> doable?

Of course, with include() you can include the content of a file into a 
script file *before* it gets interpreted. But what it looks like in the 
resulting output and whether there is a box or a frame is entirely up to 
you.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux