Lock
Lock

Reputation: 5522

How to create a volt URL with parameters

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?

Upvotes: 2

Views: 3926

Answers (2)

Chris Schreiber
Chris Schreiber

Reputation: 51

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]) }}

Upvotes: 5

Raj
Raj

Reputation: 1083

{{ url("order/view/id/" ~  order.id) }}

Upvotes: 4

Related Questions