Zend routing: removing null parameters from the URL -


if have route defined this:

/event/:id/:instance_id/view

it appears in url when both parameters set.

example.com/event/1/15/view

however, instance_id optional, , therefore may null, url looking (as created url helper):

example.com/event/1//view

i want this:

example.com/event/1/view

how remove unnecessary forward slash?

the above question zend 1 , below solution zend 2, please dis-regard answer.

route not 'instance_id' optional. can achieve doing this

'route' => '/event/:id[/:instance_id]/view', 

it should fix url problem. ideally, 'view' should after 'event', if possible in scenario.

'route' => '/event/view/:id[/:instance_id]',  

any fix text should ideally come first in route , optional last.


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -