2017 © Pedro Peláez
 

library viewengine

Lightweight php template engine system

image

jmon/viewengine

Lightweight php template engine system

  • Friday, August 21, 2015
  • by joan-mon
  • Repository
  • 1 Watchers
  • 0 Stars
  • 10 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Lightweight PHP template engine

Features

  • Fast, (*1)

  • Powerful, (*2)

  • Easy, (*3)

Installing

@todo, (*4)

Getting started

  • Simple template:
/base/path/|
           |_ simple-template.phtml
           |_ script.php
<!-- simple-template.phtml -->
<!DOCTYPE html>
<html>
   <head>
       <title><?= \jmon\TplEngine\View::get('title') ?></title>
   </head>
   <body>
       <h1><?= \jmon\TplEngine\View::get('title') ?></h1>
   </body>
</html>


```php
<?php
 // script.php
use jmon\TplEngine\View;
View::setBasePath('/base/path');
View::set('title', 'hello world!');
echo View::render('simple-template.phtml');
?>
```html <!-- final rendering --> <!DOCTYPE html> <html> <head> <title>hello world!</title> </head> <body> <h1>hello world!</h1> </body> </html>
   * Template with layout:
/base/path/| |_ layout.phtml |_ home/index.phtml |_ script.php
```html
<!-- layout.phtml -->
<!DOCTYPE html>
<html>
   <head>
       <title><?= \jmon\TplEngine\View::get('title') ?></title>
   </head>
   <body>
         <!-- Place where will be rendered the content of templates that extends this one -->
       <?= \jmon\TplEngine\View::content() ?>
   </body>
</html>
```html <!-- home/index.phtml --> <?php \jmon\TplEngine\View::templateExtend('layout.phtml')?> <h1><?= \jmon\TplEngine\View::get('title') ?></h1>
```php
<?php
 // script.php
use jmon\TplEngine\View;
View::setBasePath('/base/path');
View::set('title', 'hello world!');
echo View::render('/home/index.phtml');
?>
```html <!-- final rendering --> <!DOCTYPE html> <html> <head> <title>hello world!</title> </head> <body> <h1>hello world!</h1> </body> </html>
   * Use of partial:
/base/path/| |_ template.phtml |_ partial.phtml |_ script.php
```html
<!-- template.phtml -->
<!DOCTYPE html>
<html>
   <head>
       <title><?= \jmon\TplEngine\View::get('title') ?></title>
   </head>
   <body>
       <h1><?= \jmon\TplEngine\View::get('title') ?></h1>
       <?php \jmon\TplEngine\View::partial('partial.phtml')?>
   </body>
</html>
```html <!-- partial.phtml --> <footer><?= \jmon\TplEngine\View::get('footer-text') ?></footer>
```php
<?php
 // script.php
use jmon\TplEngine\View;
View::setBasePath('/base/path');
View::set('title', 'hello world!');
View::set('footer-text', 'Awesome footer!');
echo View::render('template.phtml');
?>
```html <!-- final rendering --> <!DOCTYPE html> <html> <head> <title>hello world!</title> </head> <body> <h1>hello world!</h1> <footer>Awesome footer!</footer> </body> </html>

The Versions

21/08 2015

dev-master

9999999-dev

Lightweight php template engine system

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

The Development Requires

template php engine view

21/08 2015

1.0.0

1.0.0.0

Lightweight php template engine system

  Sources   Download

MIT

The Requires

  • php >=5.5.0

 

The Development Requires

template php engine view