2017 © Pedro Peláez
 

library template

PHP Engine Template

image

makframework/template

PHP Engine Template

  • Saturday, May 13, 2017
  • by JuniorOcheiRuiz
  • Repository
  • 1 Watchers
  • 0 Stars
  • 4 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Template

PHP Template Engine, (*1)

It's a Template Engine developed with Twig as base., (*2)

Requeriments

  • PHP Version 7.1 or higher
  • Composer

Installation

$ composer require makframework/template

Usage

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>

Authors

License

Makframework\Template is licensed under the MIT license., (*7)

The project include others third-party libraries that can contain its own licenses: - Twig, (*8)

The Versions

13/05 2017

dev-master

9999999-dev

PHP Engine Template

  Sources   Download

MIT

The Requires

 

by Junior Ochei Ruiz

13/05 2017

v0.1.0

0.1.0.0

PHP Engine Template

  Sources   Download

MIT

The Requires

 

by Junior Ochei Ruiz