Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 01-29-2008, 09:22 PM
Junior Member
 
Join Date: Jan 2008
Posts: 1
Default routing, user parameters, and $this->getRequest()->getUserParams()

Check out Zend_Controller_Request_Abstract. The getParams() and getUserParams() returns the exact same thing. I came upon this because I want to get user parameters differently than the default key/value way. Stripping out the 'method', 'controller' and 'action' key/values is easy, but the getUserParams() should do that for me. I don't consider this a bug, just a function not doing what it's supposed to do. Any developers reading this, umm, make it work? TIA

I have a routing question. I have a user controller (UserController) and I want to pass parameters to the default action without specifying the 'index' action in the URL.

Here's what I want to do:

http://localhost/app/user/id/672

I want this URL to execute the indexAction() in UserController so that I can extract the id parameter. Of course, the default setup looks for the 'id' action and returns a fatal error.

How can I make the router use the 'index' action when it can't find a valid action?

Thanks.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 01-30-2008, 08:41 AM
Member
 
Join Date: Aug 2007
Location: Sweden
Posts: 52
Send a message via MSN to Leif.Högberg
Default

Not exactly what you are looking for but one way of doing it is by adding a custom route.

PHP Code:
$router $controller->getRouter();
$route = new Zend_Controller_Router_Route('foobar/:id',
    array(
'module' => 'mymod''controller' => 'myctrl''action' => 'index'), array('id' => '\d+'));
$router->addRoute('my_custom_route'$route); 
Above will redirect all requests like 'http://site/foobar/<any number>/'
to 'http://site/mymod/myctrl/index/id/<id>/'

You can also extend the router or routes with your own logic if the above doesn't cut it.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 06:38 PM.