|
wilshire
free radical


Registered: 05/11/05
Posts: 2,421
Loc: SE PA
Last seen: 14 years, 3 months
|
html head using a php include function?
#8154359 - 03/16/08 06:08 PM (16 years, 2 months ago) |
|
|
i'm making a website and using php include functions to load content that is common across pages.
is there any reason why this shouldn't be done for the head?
also, i've noticed that in a lot of websites, the URL's are missing file extensions. is there a good reason that people do this?
|
ectolysergic
Stranger
Registered: 02/23/08
Posts: 42
Last seen: 15 years, 8 months
|
Re: html head using a php include function? [Re: wilshire]
#8155018 - 03/16/08 08:51 PM (16 years, 2 months ago) |
|
|
if what you are including goes in the head tags sure otherwise just include it in the body
|
beatyou
one



Registered: 02/21/06
Posts: 618
Loc: austin, tx
Last seen: 2 years, 9 months
|
Re: html head using a php include function? [Re: ectolysergic]
#8155742 - 03/16/08 11:37 PM (16 years, 2 months ago) |
|
|
the reason people are taking off file extensions in modern webapps/sites is for SEO
www.site.com/products/chairs/leather-beanbag is better than www.site.com/products.php?cat=341&prodID=3483942329
this is usually done via mod_rewrite w/ apache
|
Seuss
Error: divide byzero



Registered: 04/27/01
Posts: 23,480
Loc: Caribbean
Last seen: 3 months, 8 days
|
Re: html head using a php include function? [Re: wilshire]
#8156212 - 03/17/08 05:50 AM (16 years, 2 months ago) |
|
|
> the reason people are taking off file extensions in modern webapps/sites is for SEO
SEO = search engine optimization
Another reason is for 'security through obscurity' ... though for this reason, it is fairly pointless. (There is no such thing as security through obscurity... it isn't security, it is luck.)
The only real downside to includes (from a performance standpoint) is the overhead of the extra filesystem access. Rather than fetching one file to serve the page, the system may have to fetch three or four files (depending on the number of includes). With caches on the server and optimization engines (such as Zend), these downsides are mostly negated.
-------------------- Just another spore in the wind.
|
ectolysergic
Stranger
Registered: 02/23/08
Posts: 42
Last seen: 15 years, 8 months
|
Re: html head using a php include function? [Re: Seuss]
#8156339 - 03/17/08 07:35 AM (16 years, 2 months ago) |
|
|
the perfomance hit is nearly non-existant. it's a simple apache rewrite rule
|
Seuss
Error: divide byzero



Registered: 04/27/01
Posts: 23,480
Loc: Caribbean
Last seen: 3 months, 8 days
|
Re: html head using a php include function? [Re: ectolysergic]
#8156358 - 03/17/08 07:48 AM (16 years, 2 months ago) |
|
|
> the perfomance hit is nearly non-existant. it's a simple apache rewrite rule
I'm talking about a php include, not an apache rewrite rule. However, even an apache rewrite rule can be fairly intensive as the server has to parse a list of regular expressions for every single request (not page, but request).
-------------------- Just another spore in the wind.
|
tak
geo's henchman




Registered: 11/20/00
Posts: 3,776
Loc: nowhereland
|
Re: html head using a php include function? [Re: Seuss]
#8156415 - 03/17/08 08:28 AM (16 years, 2 months ago) |
|
|
The first time you change your layout without using a single header file, you will be kicking yourself in the ass.
-------------------- The DJ's took pills to stay awake and play for seven days.
|
Seuss
Error: divide byzero



Registered: 04/27/01
Posts: 23,480
Loc: Caribbean
Last seen: 3 months, 8 days
|
Re: html head using a php include function? [Re: tak]
#8156501 - 03/17/08 09:12 AM (16 years, 2 months ago) |
|
|
> The first time you change your layout without using a single header file, you will be kicking yourself in the ass.
Yep... this is one of those cases where a slight performance hit is more than worth the massive maintenance headache of not having common parts (headers/footers) in include files.
-------------------- Just another spore in the wind.
|
beatyou
one



Registered: 02/21/06
Posts: 618
Loc: austin, tx
Last seen: 2 years, 9 months
|
Re: html head using a php include function? [Re: Seuss]
#8165035 - 03/19/08 12:19 AM (16 years, 2 months ago) |
|
|
I've started to use CMS for all sites i develop now mainly RadiantCMS & Drupal
|
|