Title in a File-Based Engine in PHP
In all engines where content is included into the site template, the problem of the title arises. The fact is that site pages differ not only in content but also in titles. However, the title in the code is located in a completely different place.
Therefore, in addition to inserting the content, our engine needs to specify a place to insert the title. Let's come up with a corresponding command for this:
<!DOCTYPE html>
<html>
<head>
<title>{{ title }}</title>
</head>
<body>
<header>
header
</header>
<main>
{{ content }}
</main>
<header>
footer
</header>
</body>
</html>
Now let's consider the options for how we can store and retrieve page titles.