How to create a volt URL with parameters

3.8k views Asked by At

I want to create a URL using volt (Phalcon).

I have tried:

{{ url("order/view/", ["id" :order.id]) }}

However that produces a URL like:

http://localhost/gateway-new/order/view/?id=7

Whereas I would like the url to look like:

http://localhost/gateway-new/order/view/id/7

Any idea how to do this correctly?

2

There are 2 answers

0
Raj On BEST ANSWER
{{ url("order/view/id/" ~  order.id) }}
0
Chris Schreiber On

if you have a route defined like

$router->add('order/view/id/:int', array(
    'controller' => 'order', 
    'action' => 'view',
    'id' => 1))->setName('order-view');

you could use

{{ url(['for': 'order-view', 'id': order.id]) }}