Page 1 of 1

Zend routes (optional parameter)

Posted: Fri Jul 17, 2009 3:09 pm
by alex.barylski
I have the following route:

Code: Select all

 <search2>
    <route>/search/business/:rolodex/:keywords</route>
    <defaults>
      <controller>search</controller>
      <action>business</action>
    </defaults>
  </search2>
I'd like the last parameter to be optional, how is this done in Zend?

Code: Select all

/search/business/:rolodex/:keywords/?page
Is the better way of handling this just specifying another route with this third parameter?

Re: Zend routes (optional parameter)

Posted: Fri Jul 17, 2009 5:22 pm
by Eran
give the parameter a default value

Re: Zend routes (optional parameter)

Posted: Sat Jul 18, 2009 11:13 pm
by Benjamin
:arrow: Moved to PHP - Code