How to split a page into separate files? that is, so that the header, footer, and others are stored in separate files and, if necessary, connected to the page. Is it possible to lay it down with html? If not, then through js, jquery

  • it is better to use the collector (grunt / gulp) + template engine (say pug). Html does not help here, do it js'om - non - kosherno - MedvedevDev
  • Thank! If possible, show a small example - Alex Ander
  • there are a million templaters. You can use reactjs, but judging by the question, the reactor is still very early to study) The very same were similar questions. If you are using a godless pkhp, then <? include('../main.html') /> <? include('../main.html') /> - Herrgott
  • I know about pkhp, but I wanted to get by with them - Alex Ander
  • html is just a markup language and everything, in principle, there are no functions except rendering - Herrgott

3 answers 3

You can work with frameworks. Splitting a single dialog box in the browser into multiple blocks. Create a separate file with a list of actions, and then in the main file, make a link to this file / files.

 <frameset= cols , rows =??? > <frame src = " " > </frameset> 

    If the goal is to build a simple website on several pages, and in order to make it easier to edit some common html-blocks, you can use another technology such as SSI, which does not require the use of any programming languages, but only so that it is enabled on the server. Just in the file, for example index.html, connect your blocks:

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

      I threw in a small gulp based builder, it may come in handy:

      https://github.com/MedvedevWeb/gulp-html-builder

      In src / pug, everything is actually what you have to work with, then you will only have to deal with pug (and gulp for the future)