dev-master
9999999-devPHP Engine Template
MIT
The Requires
by Junior Ochei Ruiz
v0.1.0
0.1.0.0PHP Engine Template
MIT
The Requires
by Junior Ochei Ruiz
Wallogit.com
2017 © Pedro Peláez
PHP Engine Template
PHP Template Engine, (*1)
It's a Template Engine developed with Twig as base., (*2)
$ composer require makframework/template
Create a index.php file with the following code:, (*3)
<?php
require 'vendor/autoload.php';
$tpl = new Template('./templates/');
$tpl->registerLanguages(['es' => './languages/es.ini']);
$tpl->setData('user_id', 10);
echo $tpl->render('home.html', ['title' => 'home', 'products' => ['PC','Mobile']]);
If you also want to translate any words, create a ".ini" file with the following code:, (*4)
Some to translate = Algo para traducir
Create a ".html" file with the following code:, (*5)
<html>
<head>
<title>{{title}}</title>
</head>
<body>
<p>User ID: {{user_id}}</p>
<ul>
{% for product in products %}
<li>{{producto}}</li>
{% endfor %}
</ul>
<!-- translation -->
<p>{{'Some to translate'|translate}}</p>
</body>
</html>
The output:, (*6)
<html>
<head>
<title>home</title>
</head>
<body>
<p>User ID: 10</p>
<ul>
<li>PC</li>
<li>Mobile</li>
</ul>
<!-- translation -->
<p>Algo para traducir</p>
</body>
</html>
Makframework\Template is licensed under the MIT license., (*7)
The project include others third-party libraries that can contain its own licenses: - Twig, (*8)
PHP Engine Template
MIT
PHP Engine Template
MIT