What is the difference between ‘url’ and ‘path’ in symfony2.3

They are very similar. path() Generates a relative/absolute path : path(‘contact’) will generate /contact url() Generates a scheme-relative/absolute url, ie domain + path url(‘contact’) will generate http://example.org/contact The url() style is useful when using cross-domain ajax or generating emails, because the hostname won’t be the same. Take a look at the code https://github.com/symfony/symfony/blob/master/src/Symfony/Bridge/Twig/Extension/RoutingExtension.php for more … Read more

Nested if else in Twig

elseif needs to be single word tag/keyword and expression shouldn’t have parenthesis same as if expression. http://twig.sensiolabs.org/doc/tags/if.html <body {% if page|default(‘login’) == ‘login’ %} class=”login” {% elseif page == ‘other’ %} class=”login” {% else %} class=”noclass” {% endif %}> </body>

Twig date difference

Since PHP 5.3 There is another option without to write an extension. This example show how to calc the plural day/days {# endDate and startDate are strings or DateTime objects #} {% set difference = date(endDate).diff(date(startDate)) %} {% set leftDays = difference.days %} {% if leftDays == 1 %} 1 day {% else %} {{ … Read more

Symfony 2 – Working with assets

Regarding images, if you added it into your public folder, I think there’s no need to perform assets:update However, if you add the image within the resources folders of a bundle, you might have to, depending on your OS and which options you used when called assets:install If you’re using an OS which supports symlinks … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)