Answer the question
In order to leave comments, you need to log in
How to properly split an HTML template? On the example of Modx
The question arose about the standardization of the code and, in general, the rules of good form. Which is better to choose from 2 options?
Version 1
<!doctype html>
<html lang="en">
<head>
</head>
<body>
</body>
</html>
<meta charset="UTF-8">
<title>Document</title>
<!doctype html>
<html lang="en">
<body>
</body>
</html>
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
Answer the question
In order to leave comments, you need to log in
In the first option, we can connect some extras inside one of all the templates. scripts and styles so that they only load on the right pages. So I'm for the first option.
I once did this:
1. Divided the layout into chunks
{html_begin}
<html>
<head>
<!-- тут стандартные элементы для верстки, script, link и т.п.
</head>
<body>
<!-- тут верстка хидера и т.п. стандартных элементов, всякие меюшки, еще какая логика -->
<!-- тут подключение script и т.п. -->
</body>
</html>
{html_begin}
<!-- здесь вставляем нестандартные элементы, зависящие он конкретного шаблона
{body_begin}
{{content}}
{body_end}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question