Update README.md

This commit is contained in:
Ivan Shalganov 2014-05-11 23:38:13 +04:00
parent 4aa42105b0
commit 766a4c4ed2
1 changed files with 4 additions and 59 deletions

View File

@ -1,72 +1,17 @@
Fenom - Template Engine for PHP
===============================
> Composer [package](https://packagist.org/packages/fenom/fenom): `{"fenom/fenom": "2.*"}`.
> Composer [package](https://packagist.org/packages/fenom/fenom): `{"fenom/fenom": "2.*"}`. <br />
> For old version: `{"fenom/fenom": "1.*"}`. List of incompatibilities between 1.* and 2.* versions.
[![Latest Stable Version](https://poser.pugx.org/fenom/fenom/v/stable.png)](https://packagist.org/packages/fenom/fenom)
[![Build Status](https://travis-ci.org/bzick/fenom.svg?branch=develop)](https://travis-ci.org/bzick/fenom)
[![Coverage Status](https://coveralls.io/repos/bzick/fenom/badge.png?branch=develop)](https://coveralls.io/r/bzick/fenom?branch=master)
[![Total Downloads](https://poser.pugx.org/fenom/fenom/downloads.png)](https://packagist.org/packages/fenom/fenom)
## [Quick start](./docs/start.md) :: [Documentation](./docs/readme.md) :: [Benchmark](./docs/benchmark.md) :: [Articles](./docs/articles.md)
## [Quick start](./docs/start.md) :: [Documentation](./docs/readme.md) :: [Benchmark](./docs/benchmark.md)
<!-- :: [Articles](./docs/articles.md) -->
## What is it
*Fenom* (from "fenomenal") — шаблонизатор на PHP с большими возможностями и синтаксисом Smarty.
*Fenom* (from "fenomenal") — lightweight template enagine for PHP with with great opportunities and Smarty-like [syntax](./docs/syntax.md).
* Simple [syntax](./docs/syntax.md)
* [Fast](./docs/benchmark.md)
* [Secure](./docs/settings.md)
* [Flexible](./docs/ext/extensions.md)
* [Lightweight](./docs/benchmark.md#stats)
* [Powerful](./docs/readme.md)
* Easy to use:
Simple template
```smarty
<html>
<head>
<title>Fenom</title>
</head>
<body>
{if $templaters.fenom?}
{var $tpl = $templaters.fenom}
<div>Name: {$tpl.name}</div>
<div>Description: {$tpl.name|truncate:80}</div>
<ul>
{foreach $tpl.features as $feature}
<li>{$feature.name} (from {$feature.timestamp|gmdate:"Y-m-d H:i:s"})</li>
{/foreach}
</ul>
{/if}
</body>
</html>
```
Display template
```php
<?php
$fenom = Fenom::factory('./templates', './compiled', Fenom::AUTO_RELOAD);
$fenom->display("pages/about.tpl", $data);
```
Get content
```php
<?php
$fenom = Fenom::factory('./templates', './compiled', Fenom::AUTO_RELOAD);
$content = $fenom->fetch("pages/about.tpl", $data);
```
Runtime compilation
```php
<?php
$fenom = new Fenom();
$template = $fenom->compileCode('Hello {$user.name}! {if $user.email?} Your email: {$user.email} {/if}');
$template->display($data);
// or
$content = $template->fetch($data);
```