Skip to content

Commit

Permalink
formatition
Browse files Browse the repository at this point in the history
  • Loading branch information
Lars Krüger committed Jun 16, 2011
1 parent 05eafc0 commit 6f41dd5
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
This Symfony2 Bundle adds the possibility to render strings instead of files with the Symfony2 native Twig templating engine.
TwigstringBundle information & howto
====================================

`git remote add upstream https://github.com/LaKrue/TwigstringBundle.git`
This Symfony2 Bundle adds the possibility to render strings instead of files with the Symfony2 native Twig templating engine.

1. install on your project:
---------------------------

`git submodule add git://github.com/LaKrue/TwigstringBundle.git src/LK/TwigstringBundle`

2. set configuration on config.yml (as top level entry):
--------------------------------------------------------

`lk_twigstring: ~`

3. set autoload.php
-------------------

``` php
$loader->registerNamespaces(array(
Expand All @@ -22,6 +26,7 @@ $loader->registerNamespaces(array(
````

4. set AppKernel.php
--------------------

``` php
$bundles = array(
Expand All @@ -32,12 +37,15 @@ $bundles = array(
```

5. use LK/TwigstringBundle:
---------------------------

``` php
// set example parameter
$vars = array('var'=>'x');

// get renderstring service
$tpl_engine = $this->get('twigstring');

// render example string
$vars['test'] = 'u ' . $tpl_engine->render('v {{ var }} {% if var is defined %} y {% endif %} z{% for i in 1..5 %} {{ i }}{% endfor %}', $vars);
```
Expand All @@ -52,6 +60,8 @@ $vars = array('var'=>'x');
$vars['test'] = 'u ' . $this->get('twigstring')->render('v {{ var }} {% if var is defined %} y {% endif %} z{% for i in 1..5 %} {{ i }}{% endfor %}', $vars);
```

output would be: u v x y z

Authors:
--------
LarsK, cordoval

0 comments on commit 6f41dd5

Please sign in to comment.