Skip to content

Instantly share code, notes, and snippets.

@serapheem
Created July 21, 2013 04:57
Show Gist options
  • Save serapheem/6047536 to your computer and use it in GitHub Desktop.
Save serapheem/6047536 to your computer and use it in GitHub Desktop.
Symfony2 - Rendering controller action from template
Twig:
{# app/Resources/views/base.html.twig #}
{# ... #}
<div id="sidebar">
{% render "AcmeArticleBundle:Article:recentArticles" with {'max': 3} %}
</div>
PHP:
<!-- app/Resources/views/base.html.php -->
{# ... #}
<div id="sidebar">
<?php echo $view['actions']->render('AcmeArticleBundle:Article:recentArticles', array('max' => 3)) ?>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment