Answer the question
In order to leave comments, you need to log in
How to "combine" several html documents into one?
Hello!
In other words, I want to make a "dynamic" site (something like this) - for example, for the header, do not change everything a hundred times on different pages, but change it in one file. How to do it? Already googled, there are strange solutions.
And how is it generally done?
Thank you.
Answer the question
In order to leave comments, you need to log in
If you already have php in your tags, then you can’t forget about include .
For good, the page is divided into parts, where each part is either a piece of static html or a template for data output. There are quite a lot of templates for templates, you can choose according to your capabilities and level of knowledge.
<? require_once 'header.php'; // Загрузка шапки ?>
Тут контент.
<? require_once 'footer.php'; // Загрузка подвала ?>
you can write it in jquery
$(function(){
var includes = $('[data-include]');
jQuery.each(includes, function(){
var file = 'nameFolder/' + $(this).data('include') + '.html';
$(this).load(file);
});
})
<div data-include="nameSection"></div>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question