#6126: URLs don't get rewritten properly when using named parameters
-------------------------------------------+--------------------------------
    Reporter:  pshevtsov                   |          Type:  Bug               
      Status:  new                         |      Priority:  Medium            
   Milestone:  1.2.x.x                     |     Component:  Routing/Dispatcher
     Version:  1.2 Final                   |      Severity:  Normal            
    Keywords:  routing "named parameters"  |   Php_version:  n/a               
Cake_version:  1.2.1.8004                  |  
-------------------------------------------+--------------------------------
 When adding named parameters to links, URLs ain't rewritten with routing
 rules.

 There is the following line in routes.php:

 {{{
 #!php
 <?php
 Router::connect('/companies/categories/:action/*', array('controller' =>
 'company_categories'));
 ?>
 }}}

 and the following lines in the view code:


 {{{
 #!php
 <?php
 echo $html->link('Brief', array (
     'controller' => $this->params['controller'],
     'action' => $this->params['action'],
     $this->params['pass'][0]
 ));
 // the above code outputs /companies/categories/view/SOME_ID link

 echo $html->link('Full', array (
     'controller' => $this->params['controller'],
     'action' => $this->params['action'],
     $this->params['pass'][0],
     'v' => 'full'
 ));
 // the above code outputs /company_categories/view/SOME_ID/v:full link
 ?>
 }}}

 As it is seen in the code comments above, the link URL without named
 parameter becomes rewritten properly, while the one with named parameter
 not.

 The possible workaround was provided by poLK in IRC to add the following
 line to routes.php:

 {{{
 #!php
 <?php
 Router::connectNamed(array('v'), array('default' => true));
 ?>
 }}}

-- 
Ticket URL: <https://trac.cakephp.org/ticket/6126>
CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/>
Cake is a rapid development framework for PHP which uses commonly known design 
patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC. 
Our primary goal is to provide a structured framework that enables PHP users at 
all levels to rapidly develop robust web applications, without any loss to 
flexibility.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"tickets cakephp" group.
To post to this group, send email to tickets-cakephp@googlegroups.com
To unsubscribe from this group, send email to 
tickets-cakephp+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/tickets-cakephp?hl=en
-~----------~----~----~----~------~----~------~--~---

  • [CakePHP : The Rapid Dev... CakePHP : The Rapid Development Framework for PHP

Reply via email to