Re: router help

2012-07-21 Thread Mike Griffin
On Fri, Jul 20, 2012 at 11:23 PM, elogic  wrote:
> Hello,
>
> I am having some issues with my routes, I have put in the below route so I
> can have my front end pages all go to my contents controller view page.
> e.g. /home shows /contents/view/home or /about-us shows
> /contents/view/about-us (I'm using a slug)
>
> Router::connect('/*', array('controller' => 'contents', 'action' =>
> 'view'));
>
> This works as needed for that part however now all of my other controller
> links are routing to the same area.
>
> e.g. /admin/users/login or /users/index etc all go to the contents/view
> controller / action.
>
> How can I get around this so both items work?
>

Put that rule at the end of the route file so that it catches anything
that hasn't already been defined. Think of it like a sieve with
smaller holes the further down you get. Any specific rule only stops
things that match it exactly whereas regex rules catch more things.

To recap, put the specific rules at the top and less specific rules
further down to make it work properly.

Mike.

-- 
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: router help

2012-07-20 Thread elogic
After some more searching around I came up with the following:


*Router::connect('/', array('controller' => 'contents', 'action' => 
'view'));
Router::connect('/:slug', array('controller' => 'contents', 'action' => 
'view', array('routeClass' => 'SlugRoute')));*


It seems to be working for my requirements however I wanted to see if this 
was the best way to do it or should it be done differently?

Thankyou

-- 
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


router help

2012-07-20 Thread elogic
Hello,

I am having some issues with my routes, I have put in the below route so I 
can have my front end pages all go to my contents controller view page.
e.g. /home shows /contents/view/home or /about-us shows 
/contents/view/about-us (I'm using a slug)

Router::connect('/*', array('controller' => 'contents', 'action' => 
'view'));

This works as needed for that part however now all of my other controller 
links are routing to the same area.

e.g. /admin/users/login or /users/index etc all go to the contents/view 
controller / action.

How can I get around this so both items work? 

If I remove the * from above. i.e. Router::connect('/', array('controller' 
=> 'contents', 'action' => 'view')); the home page works but none of the 
other pages (e.g. /about-us) work but all my other controllers will work.

Thanks

Thanks

-- 
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: Router Help please !

2009-07-31 Thread DatacenterHellas

There is no one who can help me ? ? ?
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Router Help please !

2009-07-31 Thread DatacenterHellas

I use this for router


Router::connect('/:language/:controller/:action/*',array(),array
('language'=>'[a-z]{3}'));

and when I click on this link

$html->link('Greek',array('language'=>'gre'));

The returned URL is

http://www.mydomain.ext/controller/action

instead of

http://www.mydomain.ext/gre/controller/action

Why that ? ?

Also when I move my mouse over the link the status bar has this URL

http://www.mydomain.ext/gre/controller/action
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---