Jump to content

Recommended Posts

In my routes.php file, I added this:

Router::connect('/Compounds/:action/*',array('controller' =>  'Substances'));
Router::connect('/Preparations/:action/*',array('controller' => 'Substances'));
Router::connect('/Formulations/:action/*',array('controller' => 'Substances'));
Router::connect('/Plants/:action/*',array('controller' => 'Substances'));

and now, the links generated by Paginator all point to Compounds, even when thats not the model which has been loaded with $this->Paginator->paginate($model);

 

If I change the order, so its:

Router::connect('/Plants/:action/*',array('controller' => 'Substances'));
Router::connect('/Compounds/:action/*',array('controller' =>  'Substances'));
Router::connect('/Preparations/:action/*',array('controller' => 'Substances'));
Router::connect('/Formulations/:action/*',array('controller' => 'Substances'));

then all the paginator links point to Plants. The same problem occurs when I redirect to $this->redirect(array('action' => 'index'));

without specifying the controller. So it seems the routes page is altering the links which don't specify a controller. This wouldn't be a problem (on the contrary, it'd be helpful) if it would add the correct controller to the links, I don't know why its adding Compounds to every link.

Link to comment
https://forums.phpfreaks.com/topic/285964-cakephp-routing-messing-up-links/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.