Leoch is a simple PHP server-side template rendering engine

Installs: 6

Dependents: 0

Suggesters: 0

Security: 0

Stars: 7

Watchers: 2

Forks: 0

Type:package

dev-master 2018-04-30 19:06 UTC

This package is auto-updated.

Last update: 2024-05-22 03:00:40 UTC


README

Sele_o_001.png

Leoch is a simple PHP server-side template rendering engine.

Demo

See demo/index.php for server-side reference and demo/templates/index.leoch.php for Leoch syntax reference.

Basic Syntax

Variables

{{$var}}

Conditional Sentences

@if[...]

@elseif[...]

@else

@endif

Iterators

@foreach($array in $var)

I'm a $var

@endforeach

Loops

@while[$i < 10]

$i++

@endwhile

Inside code blocks, there's no need to declare the variable under brackets.

Rendering

use Leoch\App\Processor\TemplateProcessor;

$template = new Template('demo');
$template->setSrc('example')
         ->fill([
                'somevar' => 'Some Var',
                'level' => 'basic',
                'somenumber' => 2,
                'somearray' => array('Red', 'Blue'),
                'somearray2' => array('Vermelho', 'Azul'),
            ])
         ->render();