2017 © Pedro Peláez
 

library transfiguration

A light weight templating engine made with php.

image

transfiguration/transfiguration

A light weight templating engine made with php.

  • Monday, March 5, 2018
  • by svichas
  • Repository
  • 2 Watchers
  • 5 Stars
  • 27 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 1 Open issues
  • 5 Versions
  • 4 % Grown

The README.md

, (*1)

A light-weight template engine

Travis GitHub license Packagist, (*2)

Installation

PHP versions supported: 7.0, 7.1 and 7.2, (*3)


Install with composer: (recommended), (*4)

composer require transfiguration/transfiguration 1.*
require 'vendor/autoload.php';
use Transfiguration\Transfiguration;

Download latest realease: here, (*5)


Usage

$transfiguration = new Transfiguration;
// Setting template html
$transfiguration->html($templateHtml);
// Setting template variables
$transfiguration->data($templateData);
// Setting template base path for require and include.
$transfiguration->requirePath($templatePath);

Rendering template

This function is printing template html into the page., (*6)

$transfiguration->render();

Exporting template

This function returns executed template html., (*7)

$transfiguration->export();

Transfiguration hooks

This method extends Transfiguration templating engine functionality., (*8)

$transfiguration->hook("header", function($content="") {
    return "<h1>{$content}</h1>";
});

usage in Transfiguration code, (*9)

{{ header 'This is a header.'}}

Transfiguration code

For loop

<ul>
{{ for $key : $value in var }}
    <li>{{ echo $key . " " . $value}}</li>
{{endfor}}
</ul>

If statement

{{ if $loggedin == true}}
    <b>User logged in!</b>
{{ elseif $guest == true }}
    <b>User is guest!</b>
{{ else }}
    <b>User not logged in!</b>
{{ endif }}

Print & Echo

{{echo "string"}}

or, (*10)

{{print "string"}}

Including files

{{ include 'base/footer.html' }}

or, (*11)

{{ require 'base/footer.html' }}

Setting variables

{{ var $varname = "varvalue" }}

Comments

{# This is a comment #}

The Versions

05/03 2018

dev-master

9999999-dev

A light weight templating engine made with php.

  Sources   Download

MIT

The Requires

  • php ^7.0 || ^7.1 || ^7.2

 

The Development Requires

18/02 2018

1.2.3

1.2.3.0

A light weight templating engine made with php.

  Sources   Download

MIT

The Requires

  • php ^7.0 || ^7.1 || ^7.2

 

The Development Requires

23/01 2018

1.2.2

1.2.2.0

A light weight templating engine made with php.

  Sources   Download

MIT

The Requires

  • php ^7.0 || ^7.1 || ^7.2

 

The Development Requires

11/01 2018

1.0.1

1.0.1.0

A light weight templating engine made with php.

  Sources   Download

MIT

The Requires

  • php ^5.3.3 || ^7.0

 

The Development Requires

11/01 2018

1.2.0

1.2.0.0

A light weight templating engine made with php.

  Sources   Download

MIT

The Requires

  • php ^5.3.3 || ^7.0

 

The Development Requires