I have the following code:
$routes = array(
'twitter_output' => new Zend_Controller_Router_Route(
'twitter/:username\.:format',
array('controller' => 'twitter', 'action' => 'index')
)
);
Basically I want it to match: http://site.com/twitter/edu2004eu.json (except not only json, maybe xml and others too).
But when I print my request object, it gives me:
[_params:protected] => Array ( [username\.:format] => edu2004eu.json )
but it should say:
[_params:protected] => Array ( [username] => edu2004eu, [format] => json )
I don’t know what I’m doing wrong here. Any help would be appreciated.
EDIT: I’ve tried the same with a slash instead of a dot (http://site.com/twitter/edu2004eu/json) and it seems to be working, but I want the dot (to be cool like all APIs)
I don’t think the standard route type is set to use dot as a separator. You could use a regexp route instead: