CakePHP: GET Current Controller, Action and Parameters


We will have the following url:

                      http://developerguides.blogspot.com/users/view/1/2/3

To get the current controller:

                      echo $this->params['controller'];
Output:
        users


To get the current action:

                      echo $this->action;
Output:
        view


To get the first parameter:

                      echo $this->params['pass'][0];
Output:
        1

To get the second parameter:

                      echo $this->params['pass'][1];
Output:
        2

To get the first parameter:

                      echo $this->params['pass'][2];
Output:
        3

and so on...







Comments

  1. I benefit reading this article. I demand to learn more on this topic
    Cake PHP Entwicklung

    ReplyDelete
  2. Thank you! I will be posting more soon.

    ReplyDelete
  3. Hi, perfect content.

    1. CakePHP shopping cart and CMS development, and Payment gateway integration.
    2. CakePHP customization, maintenance, integration and upgradation.
    3. CakePHP extendibles and applications for faster E-Commerce growth and profitability.

    Features of CakePHP
    CakePHP Web Development
    CakePHP Portal Development

    ReplyDelete

Post a Comment