R
R
Roman2018-04-18 18:01:01
PHP
Roman, 2018-04-18 18:01:01

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

4 answer(s)
S
Stalker_RED, 2018-04-18
@ananas_roma

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.

A
Alexander, 2018-04-18
@zkelo

<? require_once 'header.php'; // Загрузка шапки ?>
Тут контент.
<? require_once 'footer.php'; // Загрузка подвала ?>

M
Max Developer, 2018-04-18
@maximviktorovich777

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>

E
Egor Zhivagin, 2018-04-18
@Krasnodar_etc

Google "template"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question