John Cogan
John Cogan

Reputation: 41

Zend Framework alternate url routing

Not sure if it is possible with ZF 1.11 to do the following

Normal method of displaying a photo

www.mysite.com/photos/display/377486

Where 377486 is the id of a photo within mysql and can be any integer

Is it possible to have the url shortened so I get the same with

www.mysite.com/photos/377486

If this is possible what is this technique/method called?

Many thanks

Upvotes: 0

Views: 99

Answers (1)

Benabra
Benabra

Reputation: 309

No, You need 2 different route.

You can test :

routes.photos.type = "Zend_Controller_Router_Route_Regex"
routes.photos.route = "photos/display/(\d+)"
routes.photos.defaults.controller = "photos"
routes.photos.defaults.action = "display"
routes.photos.map.1 = "id"
routes.photos.reverse = "books/%d"


routes.photos_short.type = "Zend_Controller_Router_Route_Regex"
routes.photos_short.route = "photos/(\d+)"
routes.photos_short.defaults.controller = routes.photos.defaults.controller
routes.photos_short.defaults.action = routes.photos.defaults.action
routes.photos_short.map.1 = "id"
routes.photos_short.reverse = "books/%d"

Upvotes: 1

Related Questions