No, not exactly.  The idea behind the include() function in PHP is to append
and execute code to the currently running script.  This is great for
organizing your code into more easier to manage chunks.  PHP will attempt to
parse and execute the included file as a PHP file regardless of the file
extension.  So you can do this for example...

-- myhtml.html --
<div align="center">Hello <?echo $var;?></div>

-- myphp.php --
$var = "World";

This will print out "Hello World".  So that answers two questions with one
stone (err.. yah).  include() is a function not a method.  And you don't
need the <html> tag to display included html.  The browser will
automatically assume an html header upon any textual output unless otherwise

Check out the manual for more information.

Hope this helps

----- Original Message -----
Sent: Sunday, May 26, 2002 5:11 AM
Subject: [PHP] Include (Newbie question)

> Hey,
> I have just being going through the manual (windows version) and am a bit
> confused about "include",
> If I want the scope to affect the whole page I do this right:
> (example page)
> <html>
> <body>
> <?php
> include blah.php
> ?>
> some html
> <?php
> use some functions to call blah.php
> ?>
> is this correct?
> and my second question is if I am including a html file will that file
> to have a <html><head><body> etc etc
> or you must have the <html><head>etc only in one file?
> Since am confused about this and it comes straight from the RTFM()
> function.....any help appreciated. :-)
> Cheers,
> -Ryan.
> --
> PHP General Mailing List (
> To unsubscribe, visit:

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to