Zend routes (optional parameter)

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Zend routes (optional parameter)

Post 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?
User avatar
Eran
DevNet Master
Posts: 3549
Joined: Fri Jan 18, 2008 12:36 am
Location: Israel, ME

Re: Zend routes (optional parameter)

Post by Eran »

give the parameter a default value
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: Zend routes (optional parameter)

Post by Benjamin »

:arrow: Moved to PHP - Code
Post Reply