Hello!

It happens, you make up for yourself 20 HTML pages and then suddenly you need to add a block in the footer. And you have to add it in all 20 files. Is it possible to do this quickly and everywhere? PS I use Sublime Text 2. Maybe there is something in it that I don’t know?

  • For this there is php - Cone

3 answers 3

SSI, rises on any unpretentious lokalkhost (WAMP, etc.):

<!--#include virtual="/header.html"--> <!--#include virtual="/index.html"--> <!--#include virtual="/footer.html"--> 

Other page:

 <!--#include virtual="/header.html"--> <!--#include virtual="/about.html"--> <!--#include virtual="/footer.html"--> 

Thus, you save yourself from repeating the code (header.html, footer.html) in different pages. Of course, inclusions can be more complicated.

  • one
    And then how to disassemble it into separate classic HTML files? - inferusvv
  • These are the "separate classic HTML files": footer.html, index.html, about.html, header.html :) Or are you talking about? - user6550
  • one
    Yes. But then all this needs to be collected into files, where the footer, header will be inside, without any inclusions for a simple opening in the browser - inferusvv
  • 2
    I have another question: isn’t it too early for you to do web? Seriously, no offense. If you cannot understand such elementary things ... - user6550
  • one
    if you have nothing to do at all, then make on php / server side incudes and the customer (he is very happy to receive a set of files from aha, especially his programmer is happy) send a message like output type wget -rk localhost / site - zb '

I will answer my own question :)

Today I use the gulp-file-include plugin and build all the sources from src to built

    Footer one - bring it to a file, one hat - bring it to a file

    • four
      Without any PHP there, there are all JS there. But the question is - why not use PHP? - Deonis
    • one
      > because it is then sent to the customer. And everything should be in a normal form. If the customer does not have a similar server, then there is no way at all. And the best way to show the customer on your server. - user6550
    • one
      A couple of minutes google:> 15. How to replace in multiple files? Ctrl-Shift-F, then see> the WHERE field, if you press the ... button, then> you can select which files> to replace. By the way, many editors have a regular expression replacement. This is in case there are any discrepancies in the files. The quote is taken from here , it may come in handy. - Deonis
    • 2
      @ inferus-vv is not a human version, but simply inhuman. I would not want to get a site in support after such a "programmer" - zb '
    • one
      @ inferus-vv, yeah, it's too early for you to deal with customers :) - AseN