How can the block feature in Twig be utilized for horizontal inheritance in PHP template systems?
When using a PHP template system like Twig, the block feature can be utilized for horizontal inheritance by allowing child templates to override specific sections of a parent template. This can be useful for creating reusable templates with shared layouts while still allowing for customization in specific areas.
// parent_template.twig
<!DOCTYPE html>
<html>
<head>
<title>{% block title %}Default Title{% endblock %}</title>
</head>
<body>
<header>
{% block header %}Default Header{% endblock %}
</header>
<main>
{% block content %}Default Content{% endblock %}
</main>
<footer>
{% block footer %}Default Footer{% endblock %}
</footer>
</body>
</html>
```
```php
// child_template.twig
{% extends 'parent_template.twig' %}
{% block title %}Child Title{% endblock %}
{% block content %}
<h1>Welcome to the Child Template!</h1>
<p>This is the customized content for the child template.</p>
{% endblock %}