PHP. Uninteresting to load <head> </head> data as include

This might be a very stupid question, but is it awkward to load data between tags in a file and load it via PHP include ()? So it would make editing easier. Thank.

+2


source share


4 answers


No, that wouldn't be stupid. The less code duplication the better.



+8


source


Question: are you planning to use the same block <head>

on multiple pages?

If yes, then: no, it would be nice to save it in a file that can be used for multiple pages.


Second question: will it make it easier for you?



If yes, then: no, it's not a bad idea to make things easier.


And if you think "this would mean uploading / including another file, won't that kill my server?"

Then, again: no, it won't: no one will notice such an overhead :-)
(And the file, if used frequently, will most likely be cached in your OS's RAM anyway)

+4


source


No, why should it be stupid? If it adds structure to your site and allows for a clean design, that might be a good idea.

And DRY is applied.

+1


source


This follows the DRY (Do not Repeat Yourself) methodology. This is a good idea.

0


source







All Articles