Symfony .. hyperlinks on a view
My question is how to make a hyperlink in a view? Like <a href="link"></a>
in HTML. Have I to create it in an action method in the controller and 开发者_Python百科then send it to a view? or what exactly?
If you are using the Twig templating engine you would have something like
<a href="{{ path('homepage') }}">Home</a>
If you are using PHP for your templates you would have something like
<a href="<?php echo $view['router']->generate('homepage') ?>">Home</a>
homepage in the above examples is a route identifier that you must already have defined in your routing configuration
Define the anchor text in the view.
Views are exactly what they sound like they're for, providing view to the visitor. Controllers, models are all for the internal processing & logic of the application.
精彩评论