Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/runekaagaard/php-chano

A non compiled pure PHP template engine with features comparable to Django Template Language.
https://github.com/runekaagaard/php-chano

Last synced: 11 days ago
JSON representation

A non compiled pure PHP template engine with features comparable to Django Template Language.

Awesome Lists containing this project

README

        

## Chano ##

Chano is an almost direct port of Djangos Template Language to PHP. But where
Django uses its own template language, Chano is implemented as a PHP iterator
that lets you iterate over an array, stdClass or Iterator and manipulate its
content in a variety of ways, matching the capabilities of the Django Template
Language.

Besides from being able to iterate over data, all the Chano functions can also
be called on non iterable values.

Read the docs at http://chano.readthedocs.org/.

## Example ##

Below follows an example of what a template using Chano could look like:

```php


=Chano::with($title)->upper()?>



Showing =$movies->length()?> movie=$movies->pluralize()?>






=$m->counter()?>)
=$m->title->upper()?>

Rating=$m->ratings->pluralize()?>



=$m->ratings->join()?>



Link=$m->links->pluralize()?>



    links->length() < 3):?>
    =$m->links->unorderedlist()->urlize()?>

    =$m->links->unorderedlist()->urlizetrunc(12)?>




```

## Tests ##
Chano is pretty well tested with PHPT. I was able to port most of the tests for
the functions directly from Django and then add integration tests to those.

See: https://github.com/runekaagaard/php-chano/tree/master/tests.