Should I use PHP include
Hi there everyone,
Currently, I have a navigation bar which I have very badly included in the top of every page on my site. Bad idea as I have found out recently when I wanted to update a link and had to up date the whole site. Doh!
My question is should I use PHP include instead to embed my header? I suppose then I could have one navigation file and just use the include to embed it in the top of every page. Is this a better way of doing it? How much will it slow down the page loading?
I use php include throughout my site. I recommend that you use it. You will not notice to any difference in the speed of your site. Anyway, any tiny lose of performace is far outweighed by the ease of maitainence that the using include files provide.
Are you using PHP anywhere else on your site? If not then you might not need the PHP include function. Server Side Includes work just fine for that.
Using includes is recommended if you aren't doing entirely server side processing.
The only thing to be wary of is using too many. I've seen people go hyper on includes and use 20+ per page... Don't! Try and stay at 2-3 at most.
Thanks for the advice!
Thank you kindly for the advice.
In answer to your question I do have a little bit of PHP already running on my feedback page so I know PHP include is supported/running.
Thanks again guys. And thanks for the very quick response, much appreciated.