Skip to content

Commit 7a8b89c

Browse files
committed
Added documentation for hinclude default templates
1 parent dccf123 commit 7a8b89c

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

book/templating.rst

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,53 @@ in your application configuration:
704704
),
705705
));
706706
707+
.. versionadded:: 2.2
708+
Default templates per render tag was added in Symfony 2.2
709+
710+
You can define default templates per ``render`` tag (which will override any global default templates that is defined):
711+
712+
.. configuration-block::
713+
714+
.. code-block:: jinja
715+
716+
{% render '...:news' with
717+
{},
718+
{'standalone': 'js', 'default': 'AcmeDemoBundle:Default:content.html.twig'}
719+
%}
720+
721+
.. code-block:: php
722+
723+
<?php echo $view['actions']->render(
724+
'...:news',
725+
array(),
726+
array(
727+
'standalone' => 'js',
728+
'default' => 'AcmeDemoBundle:Default:content.html.twig',
729+
)
730+
) ?>
731+
732+
Or you can also specify a string to display as the default content:
733+
734+
.. configuration-block::
735+
736+
.. code-block:: jinja
737+
738+
{% render '...:news' with
739+
{},
740+
{'standalone': 'js', 'default': 'Loading...'}
741+
%}
742+
743+
.. code-block:: php
744+
745+
<?php echo $view['actions']->render(
746+
'...:news',
747+
array(),
748+
array(
749+
'standalone' => 'js',
750+
'default' => 'Loading...',
751+
)
752+
) ?>
753+
707754
.. index::
708755
single: Templating; Linking to pages
709756

0 commit comments

Comments
 (0)