Copy link to clipboard
Copied
I have read that it is good practice to put the header of page in separate php file, so that when the changes are done, they are done at one place and reflected throughout the site.
But including headers in separate file increases the download time of the page. What do you suggest in this case?
Also, is it fine that all the pages of a website bear .php extension. Are there any tradeoffs.
yashi58 wrote:
But including headers in separate file increases the download time of the page.
No, it doesn't. The PHP engine adds the output of include files before sending the response to the browser. The only time using include files would increase the download time is if you have complex programming logic in the file, but the time taken to process that logic would be the same even if it were in the same file as the main page.
The only thing you need to be careful about when using include files
...Copy link to clipboard
Copied
yashi58 wrote:
But including headers in separate file increases the download time of the page.
No, it doesn't. The PHP engine adds the output of include files before sending the response to the browser. The only time using include files would increase the download time is if you have complex programming logic in the file, but the time taken to process that logic would be the same even if it were in the same file as the main page.
The only thing you need to be careful about when using include files is that Dreamweaver has difficulties if you put the doctype, <html>, <head>, and <body> tags in an include file.
Use the .php filename extension for all include files. Although it's not mandatory, it's more secure.
Copy link to clipboard
Copied
Thanks David. That solves the issue.
I had this confusion because I checked the downloading time of the page that I designed i.e. career.html and career.php(header included in separate file) on tools.pingdom.com. For career.php page it showed 1.5 sec more to download than career.html page.