1

I'm searching for an easy way to "translate" url strings into arrays of controller/action name pairs.

example1:

/users/

should return

array('controller'=>'users','action'=>'index')

example2:

/admin/users/view/23

should return

array('controller'=>'users','action'=>'admin_view')

example3:

/

should return

array('controller'=>'pages','action'=>'home')
1
  • 1
    What's wrong with $this->params in the controller or in which other situation do you want to use this? Commented Aug 20, 2010 at 8:54

1 Answer 1

1

Router::parse could do it.

E.g.:

 <?php debug(Router::parse('/admin/users/index')) ?>

It is not exactly what you described, but chances are that this format is even better for further use, if you "stay" in cake.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.