RE: Include Files in HTML

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

 



"Bob McConnell" wrote:

> From: sono-io at fannullone.us
> 
>> In my readings, I've run across examples showing include files
> being
>> called from within the <head></head> tags, and other examples showing
> 
>> them called within <body></body>.  I've always put them in the header
> 
>> section myself, but I was wondering if one is better than the other,
>> or is it just personal preference?
> 
> Depends on what you are including. The only tags that can be inside the
> head are <base>, <link>, <meta>, <script>, <style>,  and <title>.
> Everything else is either body or prologue.
> 
> The full specs can be found at
> <http://www.w3schools.com/tags/default.asp>.
> 
> Bob McConnell

Sure enough. What the OP might not have realized:

In the end, what PHP evaluates to, is a stream of html, script, css etc 
text/data, which is sent to the browser. PHP's include( <file> ) statement 
inserts the content of <file> here-and-now. You can even put the include 
statement within a for loop in order to include something multiple times... 
In that sense it is more like a /function/ and really different from cpp's 
#include /directive/.

<file> can contain PHP code, which is evaluated as if it was here-and-now in 
the including PHP file; it can contain text/data, which is appended to the 
text/data stream being produced.

All in all, to PHP the spot of file inclusion is not interesting, as long as 
the resulting PHP code and/or stream data is meaningful.

Now back to you, Bob :-)

Regards,
Joost.

-- 
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