Re: Include Files in HTML
| From: | Tommy Pham | Date: | Fri, 04 Sep 2009 23:11:31 +0000 |
| Subject: | Re: Include Files in HTML | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-297715@lists.php.net to get a copy of this message | ||
----- Original Message ----
> From: "sono-io@fannullone.us" <sono-io@fannullone.us>
> To: PHP General List <php-general@lists.php.net>
> Sent: Friday, September 4, 2009 12:57:08 PM
> Subject: [PHP] Include Files in HTML
>
> In my readings, I've run across examples showing include files being called
> from within the tags, and other examples showing them called
> within . 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?
>
> Frank
>
> --PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
Depends on your application design and/or your desired result. If you design your application to do
all processing before output is sent starting with <html>, then all your includes goes before
<html>. If you want to have the modular approach of including css & js files inside the
<head> element, you don't have to worry about going back to changing every single output
file when you decide the change your layout or javascript framework. It also makes your code page a
bit cleaner when you do use include in the <head>. If you want to make use of chunked
encoding, you can including the rest within the <body>.
Thus, include everything before <html> gives you a slight pause 'waiting for
reply...' in the status bar before the client even begin to download anything. When includes
are scattered all over, server processes some sends the web browser info, here go fetch some more
(css, js, images) until the the last buffered output is sent </html> (that is if your page is
compliant ;)
Regards,
Tommy