Хабр Курсы для всех
РЕКЛАМА
Практикум, Хекслет, SkyPro, авторские курсы — собрали всех и попросили скидки. Осталось выбрать!
// подгружаем хелперы Symfony require_once 'path_to_symfony_project/lib/vendor/symfony/lib/helper/AssetHelper.php'; require_once 'path_to_symfony_project /lib/vendor/symfony/lib/helper/TagHelper.php';
$this->context->getConfiguration->loadHelpers(array('Asset', 'Tag'));
An sf_twig_extensions setting has been added to settings.yml that holds an array of Twig_Extension classes. sfTwigView takes all those names and tries to initiate them into Twig_Environment::addExtension(). If it cannot do that, it will throw an InvalidArgumentException.
...
<body>
{{ sf_content }}
</body>
...
<h1>Postss List</h1>
<table class="posts-list">
<thead>
<tr>
<th>Id</th>
<th>Title</th>
<th>Text</th>
<th>Modified</th>
<th>Comments count</th>
</tr>
</thead>
<tbody>
{% for posts in postss %}
<tr>
<td>{{ posts.id }{</td>
<td><a href="">{{ posts.title }}</a></td>
<td>{{ posts.text }}</td>
<td>{{ posts.modified_ }}</td>
<td>{{ posts.Comments.count }}</td>
</tr>
{% endfor %}
</tbody>
</table>
<td>{ posts.text }</td> -- потенциальная XSS
надо добавить фильтр 'escape':
<td>{ posts.text | escape }</td>
Интеграция шаблонизатора Twig в Symfony 1.4