Reputation: 891
I'm using the Yii Framework, but this could apply elsewhere.
I have a controller/action I am trying to pass a string parameter to. This string can be multiple words and if so I urlencode($string).
Example: $category = "Chocolate Cake"; thus, urlencode($category) = Chocolate+Cake
How can I then get Yii to recognize this as a parameter in the route? It appears that I need a regex that can escape the plus sign.
things I've tried:
menu/<action:\w+>/<category:\S+>'=>'menu/<action>',
or
menu/<action:\w+>/<category:\w+>'=>'menu/<action>',
Upvotes: 0
Views: 312
Reputation: 1283
Try
menu/<action:\w+>/<category:[\w ]+>'=>'menu/<action>',
Just tested it locally, and it worked on my install ;)
Upvotes: 1