Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8478259
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T18:41:48+00:00 2026-06-10T18:41:48+00:00

I wonder why no one ever asked this question. Every zend Action function in

  • 0

I wonder why no one ever asked this question.

Every zend Action function in controller class has 3 paramters, namely ‘module’, ‘controller’, and ‘action’.

What happens, when I get a parameter named ‘action’ from a form or url, for example “?action=edit” ??

I tested it: action holds its value from router, not ‘edit’.

public function someAction() {
    $params = $this->getRequest()->getParams();
...

How could I pass the parameter named “action”, if I had to ??

Thanks in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T18:41:49+00:00Added an answer on June 10, 2026 at 6:41 pm

    The default route is Zend_Controller_Router_Route_Module which uses default keys for module, controller, & action:

    protected $_moduleKey     = 'module';
    protected $_controllerKey = 'controller';
    protected $_actionKey     = 'action';
    
    // ...
    
    /**
     * Set request keys based on values in request object
     *
     * @return void
     */
    protected function _setRequestKeys()
    {
        if (null !== $this->_request) {
            $this->_moduleKey     = $this->_request->getModuleKey();
            $this->_controllerKey = $this->_request->getControllerKey();
            $this->_actionKey     = $this->_request->getActionKey();
        }
    
        if (null !== $this->_dispatcher) {
            $this->_defaults += array(
                $this->_controllerKey => $this->_dispatcher->getDefaultControllerName(),
                $this->_actionKey     => $this->_dispatcher->getDefaultAction(),
                $this->_moduleKey     => $this->_dispatcher->getDefaultModule()
            );
        }
    
        $this->_keysSet = true;
    }
    
    /**
     * Matches a user submitted path. Assigns and returns an array of variables
     * on a successful match.
     *
     * If a request object is registered, it uses its setModuleName(),
     * setControllerName(), and setActionName() accessors to set those values.
     * Always returns the values as an array.
     *
     * @param string $path Path used to match against this routing map
     * @return array An array of assigned values or a false on a mismatch
     */
    public function match($path, $partial = false)
    {
        $this->_setRequestKeys();
    
        $values = array();
        $params = array();
    
        if (!$partial) {
            $path = trim($path, self::URI_DELIMITER);
        } else {
            $matchedPath = $path;
        }
    
        if ($path != '') {
            $path = explode(self::URI_DELIMITER, $path);
    
            if ($this->_dispatcher && $this->_dispatcher->isValidModule($path[0])) {
                $values[$this->_moduleKey] = array_shift($path);
                $this->_moduleValid = true;
            }
    
            if (count($path) && !empty($path[0])) {
                $values[$this->_controllerKey] = array_shift($path);
            }
    
            if (count($path) && !empty($path[0])) {
                $values[$this->_actionKey] = array_shift($path);
            }
    
            if ($numSegs = count($path)) {
                for ($i = 0; $i < $numSegs; $i = $i + 2) {
                    $key = urldecode($path[$i]);
                    $val = isset($path[$i + 1]) ? urldecode($path[$i + 1]) : null;
                    $params[$key] = (isset($params[$key]) ? (array_merge((array) $params[$key], array($val))): $val);
                }
            }
        }
    
        if ($partial) {
            $this->setMatchedPath($matchedPath);
        }
    
        $this->_values = $values + $params;
    
        return $this->_values + $this->_defaults;
    }
    

    You can see that the default module route has default keys for mvc params, however, it will use the keys set by the request object if it exists and we can modify these keys.

    e.g. in your bootstrap:

    class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
    {
        protected function _initRequestKeys()
        {
            $this->bootstrap('frontcontroller');
            $frontController = $this->getResource('frontcontroller');
            /* @var $frontController Zend_Controller_Front */
    
            $request = new Zend_Controller_Request_Http();
    
            // change action key
            $request->setActionKey("new_action_key");
    
            // change module
            $request->setModuleKey("new_module_key");
    
            // change controller
            $request->setControllerKey("new_controller_key");
    
    
            // don't forget to set the configured request
            // object to the front controller
            $frontController->setRequest($request);
        }
    }
    

    Now you can use module, controller, & action as $_GET params.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i wonder if one should create a helper function in a class as a
I've asked a question like this before but this one is different, this is
I know this is a rather academic question, but I wonder how one would
I hardly ever see the second one used and I wonder why? Neither would
I'm researching the Git and Bazaar capabilities and wonder which one has more feature-rich
I wonder why one of my projects has VDSERR.h listed under "External Dependencies" and
I wonder do one have to reflect the associated property in the class If
Ever wonder what wikipedia's database schema looks like? I recently read this thread from
Ok, this is possibly borderline-subjective, but I wonder where one would put a simple
I wonder if one can let the user specify an installation directory for an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.