Re: $this->params['named'] is empty
its not that difficult, man^^ function register() { if (!empty($this->params['named']['abort'])) { # here you can see that abort:1 would delete the session content $this->Session->delete('Auth.Tmp'); $this->redirect(array('action' => 'login')); } ... } just put pr($this->params); inside your action and you will see how it works On 25 Sep., 15:19, Sarpidon wrote: > Can someone give me an example. I just cannot make it work. > > Category Controller: > public function view() {} > > Routes: > Router::connectNamed(array('alias')); > > url > /categories/view/alias:something > > $this->params['named'] comes up empty ... > > On Sep 25, 12:19 am, Miles J wrote: > > > > > Because you are not passing them as named params, you are passing them > > as method arguments. > > > public function view($category) { } > > > On Sep 24, 7:17 am, Sarpidon wrote: > > > > Hi. I am not sure what I am doing wrong but even though I am using > > > named params $this->params['named'] always shows up as empty. > > > > Routes > > > Router::connect('/news/:category', array('controller' => 'categories', > > > 'action' => 'view'), array('pass' => array('category'))); > > > > View > > > echo $html->link($link['name'], array('controller' => 'categories', > > > 'action' => 'view', 'category' => $link['alias'])); > > > > pr($this->params) > > > [category] => europe > > > [named] => Array > > > ( > > > ) > > > > [pass] => Array > > > ( > > > [0] => greece > > > ) > > > > I also tried > > > Router::connectNamed(array('category')); > > > Router::connect('/news/:category', array('controller' => 'categories', > > > 'action' => 'view'), array('pass' => array('category'))); > > > > and > > > Router::connectNamed(array('category')); > > > Router::connect('/news/*, array('controller' => 'categories', 'action' > > > => 'view')); > > > > no success > > > > any help? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: $this->params['named'] is empty
if u have url /categories/view/alias:something then if u don't do this: Router::connectNamed(array('alias')); should $this->params["named"]["alias]] exists with "something" value -- Tilen Majerle http://majerle.eu 2010/9/25 Sarpidon > Can someone give me an example. I just cannot make it work. > > Category Controller: > public function view() {} > > Routes: > Router::connectNamed(array('alias')); > > url > /categories/view/alias:something > > $this->params['named'] comes up empty ... > > On Sep 25, 12:19 am, Miles J wrote: > > Because you are not passing them as named params, you are passing them > > as method arguments. > > > > public function view($category) { } > > > > On Sep 24, 7:17 am, Sarpidon wrote: > > > > > Hi. I am not sure what I am doing wrong but even though I am using > > > named params $this->params['named'] always shows up as empty. > > > > > Routes > > > Router::connect('/news/:category', array('controller' => 'categories', > > > 'action' => 'view'), array('pass' => array('category'))); > > > > > View > > > echo $html->link($link['name'], array('controller' => 'categories', > > > 'action' => 'view', 'category' => $link['alias'])); > > > > > pr($this->params) > > > [category] => europe > > > [named] => Array > > > ( > > > ) > > > > > [pass] => Array > > > ( > > > [0] => greece > > > ) > > > > > I also tried > > > Router::connectNamed(array('category')); > > > Router::connect('/news/:category', array('controller' => 'categories', > > > 'action' => 'view'), array('pass' => array('category'))); > > > > > and > > > Router::connectNamed(array('category')); > > > Router::connect('/news/*, array('controller' => 'categories', 'action' > > > => 'view')); > > > > > no success > > > > > any help? > > Check out the new CakePHP Questions site http://cakeqs.org and help others > with their CakePHP related questions. > > You received this message because you are subscribed to the Google Groups > "CakePHP" group. > To post to this group, send email to cake-php@googlegroups.com > To unsubscribe from this group, send email to > cake-php+unsubscr...@googlegroups.comFor > more options, visit this group at > http://groups.google.com/group/cake-php?hl=en > Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: $this->params['named'] is empty
Can someone give me an example. I just cannot make it work. Category Controller: public function view() {} Routes: Router::connectNamed(array('alias')); url /categories/view/alias:something $this->params['named'] comes up empty ... On Sep 25, 12:19 am, Miles J wrote: > Because you are not passing them as named params, you are passing them > as method arguments. > > public function view($category) { } > > On Sep 24, 7:17 am, Sarpidon wrote: > > > Hi. I am not sure what I am doing wrong but even though I am using > > named params $this->params['named'] always shows up as empty. > > > Routes > > Router::connect('/news/:category', array('controller' => 'categories', > > 'action' => 'view'), array('pass' => array('category'))); > > > View > > echo $html->link($link['name'], array('controller' => 'categories', > > 'action' => 'view', 'category' => $link['alias'])); > > > pr($this->params) > > [category] => europe > > [named] => Array > > ( > > ) > > > [pass] => Array > > ( > > [0] => greece > > ) > > > I also tried > > Router::connectNamed(array('category')); > > Router::connect('/news/:category', array('controller' => 'categories', > > 'action' => 'view'), array('pass' => array('category'))); > > > and > > Router::connectNamed(array('category')); > > Router::connect('/news/*, array('controller' => 'categories', 'action' > > => 'view')); > > > no success > > > any help? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
Re: $this->params['named'] is empty
Because you are not passing them as named params, you are passing them as method arguments. public function view($category) { } On Sep 24, 7:17 am, Sarpidon wrote: > Hi. I am not sure what I am doing wrong but even though I am using > named params $this->params['named'] always shows up as empty. > > Routes > Router::connect('/news/:category', array('controller' => 'categories', > 'action' => 'view'), array('pass' => array('category'))); > > View > echo $html->link($link['name'], array('controller' => 'categories', > 'action' => 'view', 'category' => $link['alias'])); > > pr($this->params) > [category] => europe > [named] => Array > ( > ) > > [pass] => Array > ( > [0] => greece > ) > > I also tried > Router::connectNamed(array('category')); > Router::connect('/news/:category', array('controller' => 'categories', > 'action' => 'view'), array('pass' => array('category'))); > > and > Router::connectNamed(array('category')); > Router::connect('/news/*, array('controller' => 'categories', 'action' > => 'view')); > > no success > > any help? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
$this->params['named'] is empty
Hi. I am not sure what I am doing wrong but even though I am using named params $this->params['named'] always shows up as empty. Routes Router::connect('/news/:category', array('controller' => 'categories', 'action' => 'view'), array('pass' => array('category'))); View echo $html->link($link['name'], array('controller' => 'categories', 'action' => 'view', 'category' => $link['alias'])); pr($this->params) [category] => europe [named] => Array ( ) [pass] => Array ( [0] => greece ) I also tried Router::connectNamed(array('category')); Router::connect('/news/:category', array('controller' => 'categories', 'action' => 'view'), array('pass' => array('category'))); and Router::connectNamed(array('category')); Router::connect('/news/*, array('controller' => 'categories', 'action' => 'view')); no success any help? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en