A small site 5 pages. Footer Heder are the same

prescribe them like this On every page:

<? include 'blocks/header.php'; ?> <!-- Здесь код страницы --> <? include 'blocks/footer.php'; ?> 

Outwardly, everything is displayed as needed.

am i doing right or is there a better way?

every page on the site has a php extension, is it ok? (I just don't know it myself)

Closed due to the fact that it is necessary to reformulate the question so that it was possible to give an objectively correct answer to the participants of Raz Galstyan , Edward , andreymal , Viktorov , αλεχολυτ Jan 20 '18 at 10:42 .

The question gives rise to endless debates and discussions based not on knowledge, but on opinions. To get an answer, rephrase your question so that it can be given an unambiguously correct answer, or delete the question altogether. If the question can be reformulated according to the rules set out in the certificate , edit it .

  • the question is very vaguely peeped out; give a bit of food, then is the favor. - Kirill Korushkin
  • Not normal, to generate html-pages, you should use normal template engines, and this is their pitiful similarity - andreymal
  • @andreymal A controversial issue. PHP is essentially a templating engine. (Although I am also for the use of template engines - it is more convenient for them all the same). A similar approach is used even in rather big projects and in very popular CMS. Template engines still eat extra processor time and memory - tutankhamun
  • @tutankhamun well, in normal template engines, insertion of headers and footers is done by some {% extends 'base.html' %} . I don’t know if php can be so clean, but I consider the variant indicated in the question text to be worthless - andreymal
  • one
    I have only two comments: 1. Do not use short tags <? ; 2. Such pages should not contain data processing, but should be called from the pages that implement it (read about the separation of logic and display) - tutankhamun

1 answer 1

If the site has 5 pages and it will never grow again, that's fine. Most books on PHP described the creation of the site. 5-7 years ago, many who did it. Now of course it is customary to use the MVC pattern, but that’s another story.