We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Generating urls

Hi

I am trying to generate a url into volt template file as explained here: https://docs.phalcon.io/en/latest/reference/url.html#generating-uris


// MY ROUTE
$router->add('/my-custom-url', array(
    'controller' => 'MyController',
    'action' => 'myaction'
))->setName('unique-route-name');

How to generate this url on volt?

I try with:


{{ url('unique-route-name') }}

But this produce url /unique-route-name/ and not /my-custom-url/

Thanks!!



98.9k

You can use:

{{ url.get('unique-route-name') }}


8.1k

( Shouldn't that be:

{{ url.get(['for': 'unique-route-name']) }}

? )