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


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-17-2007, 11:46 PM
Junior Member
 
Join Date: Jul 2007
Posts: 5
Default How to get params in model

Hi,

I need to get params in my class located in models. How could I get them?

Example:

I'm on this url:
/admin/section/pages/

admin is a View, which "calls the model" from
application/models
That model generates a menu and I need to get the param "section" from the url in order I could highlite assiciated item in the menu.

The problem will be probably solved when I set the admin to use everytime the "index controll" and that the "section" is not an controll but the param.

But how?

Thanks.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 07-18-2007, 06:25 AM
Junior Member
 
Join Date: Jul 2007
Posts: 1
Default

PHP Code:
Zend_Controller_Front::getInstance()->getRequest->getParam('section'); 
Read this.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 07-18-2007, 07:36 AM
Junior Member
 
Join Date: Jul 2007
Posts: 5
Default

Thanks for your reply.

I already has tried this, but that hasn't worked.

This code:
PHP Code:
Zend_debug::dump($frontController->getRequest()->getParams()); 
gives me this result:

Code:
array(3) {
  ["controller"] => string(11) "admin"
  ["action"] => string(7) "section"
  ["module"] => string(7) "default"
}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 07-20-2007, 10:42 PM
Junior Member
 
Join Date: Jul 2007
Posts: 4
Default

Hi There,

I do this:
$_params = $frontController->getRequest()->getParams();
Zend_Registry::set('params', $_params);

I can then retreive the Registry object anywhere and have all params available to me with:

$params = Zend_Registry::get('params');

Cheers,
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 04:03 PM.