Introduction to the PHP Engine
Imagine that you have a site with one hundred pages. All these pages share a common structure of the following form:
<!DOCTYPE html>
<html>
<head>
<title>title</title>
</head>
<body>
<header>
header
</header>
<main>
content
</main>
<header>
footer
</header>
</body>
</html>
Usually, such pages differ only in titles and content, while all other blocks remain unchanged from page to page.
This creates certain inconveniences. For example, we need to change the text in the site header. In this case, we would have to modify one hundred files with our pages.
This is not very convenient. Therefore, with the help of PHP, a site is usually built on a special engine. This engine allows the site template to be located in a single file, and depending on the requested URL, different content is loaded into this file.
In the following lessons, we will develop several versions of the simplest engine and see what problems arise when using it.