On 1/12/11 4:02 PM, Nils Adermann wrote:
On 01/12/2011 11:56 AM, Lukas Kahwe Smith wrote:
On 12.01.2011, at 11:18, Fabien Potencier wrote:
Again the above pull removes this behavior entirely. Basically it
would go back to doing more or less a 1:1 mapping, what you ask for
is then what you get. Now you might still want to have some
automatic template switching based on the format. Then just do:
$this->render('FooBundle:Default:index.'.$this->request->getRequestFormat().'.twig);
If we go down this road, why not make the format the latest part of
the template name? That way, we gain automatic syntax highlighting in
IDEs.
A big +1 on both. As long as the .html is no longer implicit then. So
that index.twig.html would be the standard format.
I'm about to commit these changes. So, be warned that you will need to
make quite a few changes to your applications.
To sum up the changes:
Old format for a template name:
bundle:section:name(.format).renderer where .format is optional
New format:
bundle:section:name.renderer.format where everything is mandatory
Some conversion examples:
BlogBundle:Post:show.twig -> BlogBundle:Post:show.twig.html
BlogBundle:Post:show.xml.twig -> BlogBundle:Post:show.twig.xml
It means that there is also no more magic for the format part. If in a
controller, you want to deal with many formats, you can use the _format
variable like this to get the current one:
function showAction($id, $_format)
{
// ...
$templateName = '...:show.twig.'.$_format;
}
Fabien
Cheers
Nils
--
If you want to report a vulnerability issue on symfony, please send it to
security at symfony-project.com
You received this message because you are subscribed to the Google
Groups "symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en