On 9/27/10 8:15 AM, Georg wrote:
I would expect that the average symfony user would have already some
experience with templating languages (probably mostly smarty). I do not
think that a developer who develops single PHP pages would ever want to
switch to symfony, symfony is a framework for quite experienced
developers (have you ever seen a question about PHP frameworks in a
newbie forum?). And if you know one templating system, others are quite
easy to learn, this would not raise the bar much.
And I too think that the default twig templating helps less experienced
developers to create better code (no logic in templates).
I think it's more than just the generic syntax of PHP or Twig. This is
all about the possibility to easily create your own concise and
meaningful syntax with Twig.
Here is for instance how you can display a flash with PHP and Twig:
<?php echo $view['session']->getFlash('notice') ?>
{% flash "notice" %}
And how you can translate a message:
<?php echo $view['translator']->trans('Symfony2 is great!') ?>
{% trans "Symfony2 is great!" %}
And for pluralization:
<?php echo $view['translator']->transChoice(
'{0} There is no apples|{1} There is one apple|]1,Inf] There are {{
count }} apples',
10,
array('{{ count }}' => 10)
) ?>
{% transchoice count %}
{0} There is no apples|{1} There is one apple|]1,Inf] There are {{
count }} apples
{% endtranschoice %}
Which syntax is easier to read and understand? Which syntax is simpler
to learn? If I were a web designer, I would learn Symfony Twig template
syntax much faster. And I think that the same goes for the developer.
Even if you don't know Twig, you will understand the Twig templates much
faster, just because it's more concise, with less grammar characters
(<?php, $ [''], ->, (''), ...)
Note that you can of course make the PHP syntax shorted by using
functions (like what we had in symfony1), but then you will loose your
ability to extend/override things.
Fabien
--
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 symfony-devs@googlegroups.com
To unsubscribe from this group, send email to
symfony-devs+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/symfony-devs?hl=en