This repository has been archived on 2024-06-20. You can view files and clone it, but cannot push or open issues or pull requests.
peryoudow/vendor/league/plates/docs/simple-example.md
2020-01-06 14:23:12 +01:00

915 B

layout permalink title
default simple-example/ Simple example

Simple example

Here is a simple example of how to use Plates. We will assume the following directory stucture:

`-- path
    `-- to
        `-- templates
            |-- template.php
            |-- profile.php

Within your controller

// Create new Plates instance
$templates = new League\Plates\Engine('/path/to/templates');

// Render a template
echo $templates->render('profile', ['name' => 'Jonathan']);

The page template

profile.php
~~~ php layout('template', ['title' => 'User Profile']) ?>

User Profile

Hello, e($name)?>

~~~

The layout template

template.php
~~~ php <html> <head> </head> section('content')?> </html> ~~~