외부 코드를 Composer 기반으로 변경

This commit is contained in:
2018-01-28 19:25:31 +09:00
parent 8a181055a0
commit d422c03003
101 changed files with 12743 additions and 19 deletions
+54
View File
@@ -0,0 +1,54 @@
---
layout: default
permalink: simple-example/
title: 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
~~~ php
// Create new Plates instance
$templates = new League\Plates\Engine('/path/to/templates');
// Render a template
echo $templates->render('profile', ['name' => 'Jonathan']);
~~~
## The page template
<div class="filename">profile.php</div>
~~~ php
<?php $this->layout('template', ['title' => 'User Profile']) ?>
<h1>User Profile</h1>
<p>Hello, <?=$this->e($name)?></p>
~~~
## The layout template
<div class="filename">template.php</div>
~~~ php
<html>
<head>
<title><?=$this->e($title)?></title>
</head>
<body>
<?=$this->section('content')?>
</body>
</html>
~~~