Re: Routes Problem

2011-10-19 Thread majna
Maybe 
Router::connectNamed(array('id', 'url')); before those routes?

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Routes Problem

2011-10-19 Thread porangi.chris
Hi,

I'm trying to create a custom route that matches the url used by a
previous system to a new version written in cake.

Basically I have urls that are domain.com/r/i/some-name and I'd like
to match them to the categories -> display action with two named
parameters id and url.   Id maybe null as its not used by the older
system but will be in this version.

This works

Router::connect(
'/r/i/*',
array('controller' => 'categories', 'action' => 'display')
);

but doesn't give me named parameters.  The following doesn't work.

Router::connect(
'/r/i/:url/:id',
array('controller' => 'categories', 'action' => 'display',
'id' => null),
array(
'id' => '[0-9]+',
'url' => '[a-zA-Z_-]'
)
);

Can someone explain what I am missing?

Thanks

Chris

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


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


Re: Another routes problem

2010-09-15 Thread Felix
Sorry that was stupid - sorry for wasting your time!


On Sep 14, 6:17 pm, cricket  wrote:
> You have a route for '/simulations/get/' but not '/simulations/get/*'
> so Router is choosing the last one, '/simulations/*' which points to
> 'view'.
>
>
>
> On Tue, Sep 14, 2010 at 6:30 AM, Felix  wrote:
> > Hi,
>
> > I have another routing problem if anyone would be so kind,
>
> > /* Parameters */
> >        Router::connectNamed(array('download', 'payment'));
> > /* Simulations */
> >        Router::connect('/simulations', array('controller' => 'simulations',
> > 'action' => 'index'));
> >        Router::connect('/simulations/', array('controller' => 'simulations',
> > 'action' => 'index'));
> >        Router::connect('/simulations/index', array('controller' =>
> > 'simulations', 'action' => 'index'));
> >        Router::connect('/simulations/prepare', array('controller' =>
> > 'simulations', 'action' => 'prepare'));
> >        Router::connect('/simulations/get/', array('controller' =>
> > 'simulations', 'action' => 'get'));
> >        Router::connect('/simulations/view/*', array('controller' =>
> > 'simulations', 'action' => 'view'));
> >        Router::connect('/simulations/*', array('controller' =>
> > 'simulations', 'action' => 'view'));
>
> > Basically I wanted to set it so that visiting /simulations/a-
> > simulation would do /simulations/view/a-simulation.
>
> > It works for everything expect for the get action.
>
> > Basically when I enter a url such as, /simulations/get/download:123/
> > payment:123 I want it to go to /simulations/get/download:123/payment:
> > 123 but the router is sending me to /simulations/view/get/download:123/
> > payment:123
>
> > How can I fix this, it works fine for other actions, index and some
> > prefixed actions (CRUD), I can only assume its because I'm using named
> > parameters which is why I added the connectNamed bit (as per the cook
> > book).
>
> > Anyway thanks in advance,
>
> > Felix
>
> > Check out the new CakePHP Questions sitehttp://cakeqs.organd 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 
> > athttp://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: Another routes problem

2010-09-14 Thread cricket
You have a route for '/simulations/get/' but not '/simulations/get/*'
so Router is choosing the last one, '/simulations/*' which points to
'view'.

On Tue, Sep 14, 2010 at 6:30 AM, Felix  wrote:
> Hi,
>
> I have another routing problem if anyone would be so kind,
>
> /* Parameters */
>        Router::connectNamed(array('download', 'payment'));
> /* Simulations */
>        Router::connect('/simulations', array('controller' => 'simulations',
> 'action' => 'index'));
>        Router::connect('/simulations/', array('controller' => 'simulations',
> 'action' => 'index'));
>        Router::connect('/simulations/index', array('controller' =>
> 'simulations', 'action' => 'index'));
>        Router::connect('/simulations/prepare', array('controller' =>
> 'simulations', 'action' => 'prepare'));
>        Router::connect('/simulations/get/', array('controller' =>
> 'simulations', 'action' => 'get'));
>        Router::connect('/simulations/view/*', array('controller' =>
> 'simulations', 'action' => 'view'));
>        Router::connect('/simulations/*', array('controller' =>
> 'simulations', 'action' => 'view'));
>
> Basically I wanted to set it so that visiting /simulations/a-
> simulation would do /simulations/view/a-simulation.
>
> It works for everything expect for the get action.
>
> Basically when I enter a url such as, /simulations/get/download:123/
> payment:123 I want it to go to /simulations/get/download:123/payment:
> 123 but the router is sending me to /simulations/view/get/download:123/
> payment:123
>
> How can I fix this, it works fine for other actions, index and some
> prefixed actions (CRUD), I can only assume its because I'm using named
> parameters which is why I added the connectNamed bit (as per the cook
> book).
>
> Anyway thanks in advance,
>
> Felix
>
> 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
>

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


Another routes problem

2010-09-14 Thread Felix
Hi,

I have another routing problem if anyone would be so kind,

/* Parameters */
Router::connectNamed(array('download', 'payment'));
/* Simulations */
Router::connect('/simulations', array('controller' => 'simulations',
'action' => 'index'));
Router::connect('/simulations/', array('controller' => 'simulations',
'action' => 'index'));
Router::connect('/simulations/index', array('controller' =>
'simulations', 'action' => 'index'));
Router::connect('/simulations/prepare', array('controller' =>
'simulations', 'action' => 'prepare'));
Router::connect('/simulations/get/', array('controller' =>
'simulations', 'action' => 'get'));
Router::connect('/simulations/view/*', array('controller' =>
'simulations', 'action' => 'view'));
Router::connect('/simulations/*', array('controller' =>
'simulations', 'action' => 'view'));

Basically I wanted to set it so that visiting /simulations/a-
simulation would do /simulations/view/a-simulation.

It works for everything expect for the get action.

Basically when I enter a url such as, /simulations/get/download:123/
payment:123 I want it to go to /simulations/get/download:123/payment:
123 but the router is sending me to /simulations/view/get/download:123/
payment:123

How can I fix this, it works fine for other actions, index and some
prefixed actions (CRUD), I can only assume its because I'm using named
parameters which is why I added the connectNamed bit (as per the cook
book).

Anyway thanks in advance,

Felix

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: Paginator and custom routes problem (latest 1.2 alpha)

2007-05-31 Thread BenjaminB

same here, nothing helped so far

On May 31, 1:09 am, Mirko <[EMAIL PROTECTED]> wrote:
> I have exactly the same problem.
> All I get is a link with nothing but controller name in it: 
>
> Greets, Mirko


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Paginator and custom routes problem (latest 1.2 alpha)

2007-05-30 Thread Mirko

I have exactly the same problem.
All I get is a link with nothing but controller name in it: 

Greets, Mirko


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Paginator and custom routes problem (latest 1.2 alpha)

2007-04-18 Thread thequietlab

sorry, I had it like this :
Router::connect ('/sitewatch/:action/
*',array('controller'=>'favorites'));

What I posted was just part of my desperate tests ;)

On 18 Kwi, 22:08, jitka <[EMAIL PROTECTED]> wrote:
> try
> Router::connect ('/sitewatch/:action/*',
> array('controller'=>'favorites'));


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Paginator and custom routes problem (latest 1.2 alpha)

2007-04-18 Thread jitka

try
Router::connect ('/sitewatch/:action/*',
array('controller'=>'favorites'));


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Paginator and custom routes problem (latest 1.2 alpha)

2007-04-18 Thread thequietlab

as for my custom route, it's just

Router::connect ('/sitewatch/*', array('controller'=>'favorites'));

I didn;t have the time to fight with it so I just make it work without
routes.. and I'm not yet into unit testing ;)

On 18 Kwi, 18:54, gwoo <[EMAIL PROTECTED]> wrote:
> oh, silly me forgot to mention that the router has full unit test
> coverage. So, how about one that proves your case.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Paginator and custom routes problem (latest 1.2 alpha)

2007-04-18 Thread gwoo

oh, silly me forgot to mention that the router has full unit test
coverage. So, how about one that proves your case.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Paginator and custom routes problem (latest 1.2 alpha)

2007-04-18 Thread gwoo

you have not shown what your custom routes are.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Re: Paginator and custom routes problem (latest 1.2 alpha)

2007-04-18 Thread mcgordon

I just ran into this problem and came here looking for more info.  I
haven't had a chance to look into it yet but when I find something
I'll post more.  Just wanted to let you know that yours is not an
isolated case.

Marcel


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---



Paginator and custom routes problem (latest 1.2 alpha)

2007-04-18 Thread thequietlab

Hi there,

I've switched to latest 1.2 alpha lately and my paginator stoped
outputting proper url's. It happens only when I use custom routes.
Paginator generates url's without sorting parameters..
Instead of

/:controller/page:1/sort:created/direction:asc

I get

/:controller/:action/

It was working fine with 1.2.0.4451alpha..

So I tracked it down and it seems like it losses all the url params in
router.php : __mapRoute($route, $params = array()) ..

as far as I tracked it, it goes like this :

router.php : url()  checks for each route defined if it fits the
controller path which is processing, line 496 :
if ($match = $_this->mapRouteElements($route, $url)) .. before that
$url array has all the sorting params, then there is :
list($output, $url) = $match;

and $match doesn't keep $url params anymore hence all the params are
lost.

Going further through Router::mapRouteElements() and
Router::__mapRoute() it seems obvious that all the params got lost in
the latter. And I'm not really sure what is happening down there.

Does anybody have similar problem ? Is this a bug ?

Best,
Andrzej


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~--~~~~--~~--~--~---