Router::connect with :action
Hello, This is typical problem in CakePHP routing When I Router::connect('/home/vasti/:action/*', array('plugin'='vastipatrak','controller' = 'vastipatraks')); url /home/vasti/edit/4 works fine. but url /home/vasti/ is not working which i expect to redirect to index page. I am developing CMS and these routes i add dynamically in routes.php however when i add Router::connect('/home/vasti', array('plugin'='vastipatrak','controller' = 'vastipatraks')); it works fine. but i need single line router:connect option. Regards, -- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
Re: Router::connect with :action
There is not a option, if you define a route with /:action you are telling CakePHP the :action param is required. Maybe you try make this route using a custom class. http://book.cakephp.org/2.0/en/development/routing.html#custom-route-classes -- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
Re: Router::connect with :action
Also is defining that has parameters, so at least one parameter need to be sent to work this Router... Solution is Custom Routing class, as friend said, OR rewrite this route. Example: Router::connect('/home/vasti',array('plugin'='vastipatrak','controller'='vastipatraks','action'='index')); Router::connect('/home/vasti/:action',array('plugin'='vastipatrak','controller'='vastipatraks')); Router::connect('/home/vasti/:action/*',array('plugin'='vastipatrak','controller'='vastipatraks')); Em quinta-feira, 9 de agosto de 2012 11h18min39s UTC-3, Rodrigo Rodrigues Moyle escreveu: There is not a option, if you define a route with /:action you are telling CakePHP the :action param is required. Maybe you try make this route using a custom class. http://book.cakephp.org/2.0/en/development/routing.html#custom-route-classes -- 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. Visit this group at http://groups.google.com/group/cake-php?hl=en-US.
Router::Connect does not appear to work with more than one routeClass in v1.3.14
I have inherited a project which was developed in cakePHP v1.3.14. I am trying to route several different URLs to the same controller and function, but whichever I list as the second option in routes.php does not work. Here is the code from routes.php: Router::connect('/:city/locations/*', array('controller' = 'listings', 'action' = 'index_filter'), array('routeClass' = 'FilterRoute','pass' = array('city'))); Router::connect('/:city/cuisines/*', array('controller' = 'listings', 'action' = 'index_filter'), array('routeClass' = 'FilterRoute','pass' = array('city'))); The custom routeClass, 'FilterRoute' is as follows: class FilterRoute extends CakeRoute { function parse ( $url ) { $params = CakeRoute::parse ( $url ); $filter_args = split ( / , substr($url,1) ); if ( count ( $filter_args ) 1 ) { return false; } $city = array_shift ( $filter_args ); $array_to_pass = array(); while ( count ( $filter_args ) 1 ) { $item1 = array_shift ( $filter_args); $item2 = array_shift ( $filter_args ); $array_to_pass[ $item1 ] = $item2; } $params['pass'] = $array_to_pass; return $params; } } This class works fine and returns the expected array when I enter the first URL, but not for the second. I have reversed the order and again, it will work with the first URL, but not the second. Any ideas how I can have them both working? I am trying to do it this way with the URL as the client does not want a word such as 'search' within the URL and we don't know which items will be listed as filter terms. -- 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
cakePhp router::connect with couple values
Hi! I want on my website create rule, when I access: address/username the default page with user is shown. I created: Router::connect('/*', array('controller' = 'users', 'action' = 'view')); But then I cannot link any other controllers or actions. I want other rule: address/username/profil to show user profile. I created second rule: Router::connect('/*/profil/*', array('controller' = 'users', 'action' = 'profil')); It doesn't work. Can you help me? -- 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: cakePhp router::connect with couple values
Router::connect('/*', array('controller' = 'users', 'action' = 'view')); i think you need to add this at the bottom, buuut this roule is not valid if i'm right Router::connect('/*/profil/*', array('controller' = 'users', 'action' = 'profil')); -- Lep pozdrav, Tilen Majerle http://majerle.eu 2012/7/9 Chris kpyr...@gmail.com Router::connect('/*', array('controller' = 'users', 'action' = 'view')); -- 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: cakePhp router::connect with couple values
If this is not valid rule how can I do this in correct way? W dniu poniedziałek, 9 lipca 2012 14:34:18 UTC+2 użytkownik Chris napisał: Hi! I want on my website create rule, when I access: address/username the default page with user is shown. I created: Router::connect('/*', array('controller' = 'users', 'action' = 'view')); But then I cannot link any other controllers or actions. I want other rule: address/username/profil to show user profile. I created second rule: Router::connect('/*/profil/*', array('controller' = 'users', 'action' = 'profil')); It doesn't work. Can you help me? -- 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: cakePhp router::connect with couple values
On Mon, Jul 9, 2012 at 8:34 AM, Chris kpyr...@gmail.com wrote: Hi! I want on my website create rule, when I access: address/username the default page with user is shown. I created: Router::connect('/*', array('controller' = 'users', 'action' = 'view')); But then I cannot link any other controllers or actions. Yes, of course. This route matches anything and everything. So, for starters, you would have to define routes for all your other controllers and actions and place them before the one for Users::view. One way you could simplify this would be to include something in the URL before the user's name like so: www.domain.etc/users/some-user-name This would allow you to target only URLs which begin with /users/ so already things become much easier. If you don't want to do that then the next problem is to determine if whatever the URL contains is a valid username. For that you should extend CakeRoute: http://mark-story.com/posts/view/using-custom-route-classes-in-cakephp/ -- 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::connect wildcard?
Hi, I often get an 404 error as the google bot try to reach a irl like this: search.phploc=0cat=0price=0keyword=pageID=70limit=obj_id=1376bookmark_done=1LID=5 I don't know how google does this url, as this way a) it doesn't exit on my page and b) it makes no sense and c) its wrong syntax... Can I write a router::connect that forwards everything with / search.php to my home page? And/Or Can I find out this part: obj_id=1376 in oder to redirect to this article? Thanks my friends! -- 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::connect wildcard?
I would suggest using mod rewrite and send 301 headers Sent from my iPhone On Dec 12, 2011, at 12:06 PM, heohni heidi.anselstet...@consultingteam.de wrote: Hi, I often get an 404 error as the google bot try to reach a irl like this: search.phploc=0cat=0price=0keyword=pageID=70limit=obj_id=1376bookmark_done=1LID=5 I don't know how google does this url, as this way a) it doesn't exit on my page and b) it makes no sense and c) its wrong syntax... Can I write a router::connect that forwards everything with / search.php to my home page? And/Or Can I find out this part: obj_id=1376 in oder to redirect to this article? Thanks my friends! -- 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 -- 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
Sorry again Router Connect question
Hi, I am so sorry but I am still lost in this router stuff... To handle my static pages I call this: Router::connect( '/:pagename', array( 'controller' = 'pages', 'action' = 'display' ), array( 'pagename' = 'page1|page2|page3', 'pass' = array( 'pagename' ) ) ); This works so far. But I also want to use this to change language files: Router::connect('/:lng/*', array( 'controller' = 'p28n', 'action' = 'shuntRequest', 'lang' = '[a-z]{2}' )); How can I make a separation between the static pages stuff and the language change? Please advice! -- 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: Problem with Router::connect
Can anyone please help me? -- 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: Problem with Router::connect
I think you got the wrong idea about routes. With this line: Router::connect('/blechlager', array('controller' = 'pages', 'action' = 'display', 'video-1')); You are telling CakePHP that any requests to the URL /blechlager have to be treated as if /pages/display/video-1 was being requested. Because /pages/display/video-1 != /pages/display/blechlager, you are getting that error. What you should do is to use routes like /pages/display/blechlager/video-1 and treat them in the pages controller. Read more about passing arguments on the Router configuration section of the Cookbook: http://book.cakephp.org/view/948/Defining-Routes Cheers, - Johan On Tue, Jul 19, 2011 at 8:55 AM, heohni heidi.anselstet...@consultingteam.de wrote: Can anyone please help me? -- 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 -- 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
Problem with Router::connect
Hi, I have a multilingual page and I wanted to use the Router::connect stuff to 1. have such a link: $this-Html-url(array('controller' = 'pages', 'action' = 'display', strtolower(Configure::read('video.'.$this-Session- read('Config.language').'.video-1'); which creates something like this: a href=/pages/display/blechlagerBlechlager / Blecheingang/a 2. in my routes.php I added: Router::connect('/blechlager', array('controller' = 'pages', 'action' = 'display', 'video-1')); and I added the file in pages/video-1.ctp Bit its not working, like I usually know that it should work. I would expect that cake is knowing about the route connect and would write a href=/blechlagerBlechlager / Blecheingang/a and would re- connect to the video-1.ctp... It says that instead: Error: The view for PagesController::display() was not found.´ Error: Confirm you have created the file: D:\Project\views\pages \blechlager.ctp I don't know what I am doing wrong :-( Please help! -- 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: How to use Router::connect and a anchor?
Much better use standard feature: $html-link( __('Our Partners', true), array( 'controller' = 'pages', 'action' = 'display', 'partner', '#' = 'slide1' ) ) On 4 июл, 10:41, heohni heidi.anselstet...@consultingteam.de wrote: Great!Great!Great THANKS!!! On 4 Jul., 16:22, Tilen Majerle tilen.maje...@gmail.com wrote: Try this $this-Html-link(__('Our Partners', true), $this-Html-url(array('yoururlarray')) . '#slide1'); -- Lep pozdrav, Tilen Majerlehttp://majerle.eu 2011/7/4 heohni heidi.anselstet...@consultingteam.de Hi, I am using thise trick for niver urls: Router::connect('/partner', array('controller' = 'pages', 'action' = 'display', 'partner')); ?php echo $html-link(__('Our Partners', true), array('controller' = 'pages', 'action' = 'display', 'partner'),. But now, I want to link to a page like this /myproject/partner#slide1 But this is not working, the Router::connect function does not recognize the link anymore. Anyone any an idea, how to solve this? Thanks!! -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp 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 athttp://groups.google.com/group/cake-php -- 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
How to use Router::connect and a anchor?
Hi, I am using thise trick for niver urls: Router::connect('/partner', array('controller' = 'pages', 'action' = 'display', 'partner')); ?php echo $html-link(__('Our Partners', true), array('controller' = 'pages', 'action' = 'display', 'partner'),. But now, I want to link to a page like this /myproject/partner#slide1 But this is not working, the Router::connect function does not recognize the link anymore. Anyone any an idea, how to solve this? 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: How to use Router::connect and a anchor?
Try this $this-Html-link(__('Our Partners', true), $this-Html-url(array('yoururlarray')) . '#slide1'); -- Lep pozdrav, Tilen Majerle http://majerle.eu 2011/7/4 heohni heidi.anselstet...@consultingteam.de Hi, I am using thise trick for niver urls: Router::connect('/partner', array('controller' = 'pages', 'action' = 'display', 'partner')); ?php echo $html-link(__('Our Partners', true), array('controller' = 'pages', 'action' = 'display', 'partner'),. But now, I want to link to a page like this /myproject/partner#slide1 But this is not working, the Router::connect function does not recognize the link anymore. Anyone any an idea, how to solve this? 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 -- 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: How to use Router::connect and a anchor?
Great!Great!Great THANKS!!! On 4 Jul., 16:22, Tilen Majerle tilen.maje...@gmail.com wrote: Try this $this-Html-link(__('Our Partners', true), $this-Html-url(array('yoururlarray')) . '#slide1'); -- Lep pozdrav, Tilen Majerlehttp://majerle.eu 2011/7/4 heohni heidi.anselstet...@consultingteam.de Hi, I am using thise trick for niver urls: Router::connect('/partner', array('controller' = 'pages', 'action' = 'display', 'partner')); ?php echo $html-link(__('Our Partners', true), array('controller' = 'pages', 'action' = 'display', 'partner'),. But now, I want to link to a page like this /myproject/partner#slide1 But this is not working, the Router::connect function does not recognize the link anymore. Anyone any an idea, how to solve this? Thanks!! -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions sitehttp://ask.cakephp.organd 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 athttp://groups.google.com/group/cake-php -- 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
Help with 'persist' on Router::Connect
Hello again! :P can someone explain me how to set the parameter 'persist' in Router::Connect() function to achieve insert automatically the language on the first level of url in every $html-link()? I searched a lot and I didn't find a goog exlanation about this. I need url's like this: www.example.com/esp/news/... www.example.com/cat/news/... The explanation in api is as follows: persist is used to define which route parameters should be automatically included when generating new urls. You can override peristent parameters by redifining them in a url or remove them by setting the parameter to false. Ex. 'persist' = array('lang') Thanks! 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: Help with 'persist' on Router::Connect
Hi, I haven't tried this yet but I think you need to build the link using code something like echo $this-Html-link('News', array( 'controller' = 'news', 'action' = 'index', 'lang' = 'esp' )); Hope this helps. Amit Badkas PHP Applications for E-Biz: http://www.sanisoft.com On Fri, Dec 31, 2010 at 2:50 AM, talisker ofranqu...@gmail.com wrote: Hello again! :P can someone explain me how to set the parameter 'persist' in Router::Connect() function to achieve insert automatically the language on the first level of url in every $html-link()? I searched a lot and I didn't find a goog exlanation about this. I need url's like this: www.example.com/esp/news/... www.example.com/cat/news/... The explanation in api is as follows: persist is used to define which route parameters should be automatically included when generating new urls. You can override peristent parameters by redifining them in a url or remove them by setting the parameter to false. Ex. 'persist' = array('lang') Thanks! 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.comcake-php%2bunsubscr...@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: Complex Router Connect
Thanks cricket, For generate URLs it worked fine, but when i access the link i got a error Controller Sapatilhas not found. Url: http://localhost/bottero/sapatilhas/133901/compartilhar-via-email I will post my routes.php http://bin.cakephp.org/view/480208437 Any ideia? Thx. Att, Daniel On 25 nov, 01:14, cricket zijn.digi...@gmail.com wrote: On Wed, Nov 24, 2010 at 8:47 PM, Daniel sphin...@gmail.com wrote: Well guys, i trying to setup this Router and i cant made it work, Some1 have any ideia? Code: http://bin.cakephp.org/view/369700705 URL Should return: http://www.domain.com/sapatilhas/1889900-verde/compartilhar-via-email You need to pass the keys for categoria-slug modelo-slug. echo $html-link( 'E-mail', array( 'controller' = 'modelos', 'action' = 'email', 'categoria-slug' = 'sapatilhas', 'modelo-slug' = '1889900-verde' ) ); I changed the regexps, also. Although it's difficult to say what you need for categoria-slug, what you had didn't appear to make sense. Router::connect( '/:categoria-slug/:modelo-slug/compartilhar-via-email', array('controller' = 'modelos', 'action' = 'email'), array( 'categoria-slug' = '[a-z]+', 'modelo-slug' = '[-a-z0-9]+' ) ); That should work for the example URL but can you post more examples of what might be expected for categoria-slug? If it's not just straight letters the above will need to be modified. 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: Complex Router Connect
On Thu, Nov 25, 2010 at 5:06 AM, Daniel sphin...@gmail.com wrote: Thanks cricket, For generate URLs it worked fine, but when i access the link i got a error Controller Sapatilhas not found. Url: http://localhost/bottero/sapatilhas/133901/compartilhar-via-email What's this bottero? That's why the route didn't match the URL. Also, what forms can categoria-slug have? Is it always only letters (eg. a-z)? 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
Complex Router Connect
Well guys, i trying to setup this Router and i cant made it work, Some1 have any ideia? Code: http://bin.cakephp.org/view/369700705 URL Should return: http://www.domain.com/sapatilhas/1889900-verde/compartilhar-via-email It dont work.. 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: Complex Router Connect
On Wed, Nov 24, 2010 at 8:47 PM, Daniel sphin...@gmail.com wrote: Well guys, i trying to setup this Router and i cant made it work, Some1 have any ideia? Code: http://bin.cakephp.org/view/369700705 URL Should return: http://www.domain.com/sapatilhas/1889900-verde/compartilhar-via-email You need to pass the keys for categoria-slug modelo-slug. echo $html-link( 'E-mail', array( 'controller' = 'modelos', 'action' = 'email', 'categoria-slug' = 'sapatilhas', 'modelo-slug' = '1889900-verde' ) ); I changed the regexps, also. Although it's difficult to say what you need for categoria-slug, what you had didn't appear to make sense. Router::connect( '/:categoria-slug/:modelo-slug/compartilhar-via-email', array('controller' = 'modelos', 'action' = 'email'), array( 'categoria-slug' = '[a-z]+', 'modelo-slug' = '[-a-z0-9]+' ) ); That should work for the example URL but can you post more examples of what might be expected for categoria-slug? If it's not just straight letters the above will need to be modified. 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: Router::connect() not behaving as expected in 1.3?
It's not so much wrong as incomplete. Any URL *beginning* with '/ cooks/' will be handled in the above-quoted fashion. But if it begins *and ends* with '/cooks', without another routing statement, you'll get the error you're talking about. Have a look at the pre-defined routing for pages that's already in your routes.php file: Router::connect('/pages', array('controller' = 'pages', 'action' = 'index')); Router::connect('/pages/*', array('controller' = 'pages', 'action' = 'display')); There are two statements - not one - that define how that set of subdirectories will be handled. On Aug 30, 6:20 pm, Nikhil nikhilvijay...@gmail.com wrote: SacoDesign is right. its not working as expected (or the cook book is wrong) - - Here is the same from cookbook (http://book.cakephp.org/view/46/Routes-Configuration ) Another common use for the Router is to define an alias for a controller. Let's say that instead of accessing our regular URL at / users/someAction/5, we'd like to be able to access it by /cooks/ someAction/5. The following route easily takes care of that: Plain Text View Router::connect( '/cooks/:action/*', array('controller' = 'users', 'action' = 'index') ); This is telling the Router that any url beginning with /cooks/ should be sent to the users controller. It works fine except if there is no action specified that is the situation in which cake should default to index() function /cooks/action1 maps to users-action1() /cooks/action2 maps to users-action2() /cooks/index maps to users-index() *BUT* /cooks shows a CooksController missing error message On Aug 25, 6:05 pm, SacoDesign sign...@sacodesign.com wrote: Hello, I'm upgrading my app from 1.2 to 1.3. I have several custom routes setup like so: Router::connect('/blog/:action/*', array('controller'='news_articles', 'action'='index')); This works fine, except for when the url is only /blog/. In that case I get a cannot find blog controller error. Is this by design, or a bug? I can get it working by adding another route for: Router::connect('/blog', array('controller'='news_articles', 'action'='index')); but that seems wrong. Thanks, -Kevin Wentworth 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: Router::connect() not behaving as expected in 1.3?
Thanks for the example, DragonFlyEye and thanks for the feedback Nikhil. I have finally come to terms with needing 2 statements. In 1.2 (even if it was incomplete) it worked with one statement. The features of 1.3 are well worth specifying 2 routes. Thanks again! On Aug 31, 2:17 pm, DragonFlyEye dragonflyey...@gmail.com wrote: It's not so much wrong as incomplete. Any URL *beginning* with '/ cooks/' will be handled in the above-quoted fashion. But if it begins *and ends* with '/cooks', without another routing statement, you'll get the error you're talking about. Have a look at the pre-defined routing for pages that's already in your routes.php file: Router::connect('/pages', array('controller' = 'pages', 'action' = 'index')); Router::connect('/pages/*', array('controller' = 'pages', 'action' = 'display')); There are two statements - not one - that define how that set of subdirectories will be handled. On Aug 30, 6:20 pm, Nikhil nikhilvijay...@gmail.com wrote: SacoDesign is right. its not working as expected (or the cook book is wrong) - - Here is the same from cookbook (http://book.cakephp.org/view/46/Routes-Configuration ) Another common use for the Router is to define an alias for a controller. Let's say that instead of accessing our regular URL at / users/someAction/5, we'd like to be able to access it by /cooks/ someAction/5. The following route easily takes care of that: Plain Text View Router::connect( '/cooks/:action/*', array('controller' = 'users', 'action' = 'index') ); This is telling the Router that any url beginning with /cooks/ should be sent to the users controller. It works fine except if there is no action specified that is the situation in which cake should default to index() function /cooks/action1 maps to users-action1() /cooks/action2 maps to users-action2() /cooks/index maps to users-index() *BUT* /cooks shows a CooksController missing error message On Aug 25, 6:05 pm, SacoDesign sign...@sacodesign.com wrote: Hello, I'm upgrading my app from 1.2 to 1.3. I have several custom routes setup like so: Router::connect('/blog/:action/*', array('controller'='news_articles', 'action'='index')); This works fine, except for when the url is only /blog/. In that case I get a cannot find blog controller error. Is this by design, or a bug? I can get it working by adding another route for: Router::connect('/blog', array('controller'='news_articles', 'action'='index')); but that seems wrong. Thanks, -Kevin Wentworth 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: Router::connect() not behaving as expected in 1.3?
To explain a bit why the extra route is needed. The Router in 1.2 did a lot of black magic, guessing at what you meant instead of just doing what you typed. This incurred a ton of overhead as it had to attempt several different guesses at what might work for each route. Most of the guesswork was removed in 1.3 giving a big performance boost in the router. So while its a bit of a pain to have to include two routes, which I can understand I think the performance benefit and the additional explicitness the routes now have was worth it. -Mark On Aug 25, 6:05 am, SacoDesign sign...@sacodesign.com wrote: Hello, I'm upgrading my app from 1.2 to 1.3. I have several custom routes setup like so: Router::connect('/blog/:action/*', array('controller'='news_articles', 'action'='index')); This works fine, except for when the url is only /blog/. In that case I get a cannot find blog controller error. Is this by design, or a bug? I can get it working by adding another route for: Router::connect('/blog', array('controller'='news_articles', 'action'='index')); but that seems wrong. Thanks, -Kevin Wentworth 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: Router::connect() not behaving as expected in 1.3?
Not sure what order you had things in, but order is important. So, you should be able to get things working by putting these two in the following order: Router::connect('/blog/:action/*', Router::connect('/blog/*', array('controller'='news_articles')); Obviously, the /blog/* will catch all occurrences, including stuff in the other routing call. I am surprised, though, that the second call should be necessary. Assuming your controller includes a view() action and the /blog/* call doesn't include any action information (as your example shows), there should be no reason why everything else shouldn't work as advertised. On Aug 26, 4:29 pm, SacoDesign sign...@sacodesign.com wrote: Thanks for the response. I still cannot get the entire directory to respond as a controller without 2 router::connect() calls. I removed the 'action'='index' as suggested. Has anyone else experienced this issue? I removed every route from my routes.php and tried the following: Router::connect('/blog*', array('controller'='news_articles')); = missing 'BlogController' error; doesn't work for any request starting with /blog/ Router::connect('/blog/*', array('controller'='news_articles')); = /blog/ - shows index (working) = /blog/view/1/ - shows index; should show view() Router::connect('/blog/:action/*', array('controller'='news_articles')); = /blog/ - missing 'BlogController' error = /blog/view/1/ - working On Aug 25, 1:46 pm, DragonFlyEye dragonflyey...@gmail.com wrote: That all looks correct, and it would be the same in 1.2. You might write the following, though: Router::connect('/blog*', array('controller' = 'news_articles')); That would push all requests for the /blog directory to the right controller, then you can create the actions you want and they'll get filled in automatically since you didn't specify a pseudo-route for each one (which might get complicated). Cricket's right, though: by putting the pseudo route :action in there and then assigning the action 'index,' you're basically pushing every single request with a second (but no third) subdirectory in the URL to the same action. Seems like it's a bit inefficient? On Aug 25, 9:05 am, SacoDesign sign...@sacodesign.com wrote: Hello, I'm upgrading my app from 1.2 to 1.3. I have several custom routes setup like so: Router::connect('/blog/:action/*', array('controller'='news_articles', 'action'='index')); This works fine, except for when the url is only /blog/. In that case I get a cannot find blog controller error. Is this by design, or a bug? I can get it working by adding another route for: Router::connect('/blog', array('controller'='news_articles', 'action'='index')); but that seems wrong. Thanks, -Kevin Wentworth 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: Router::connect() not behaving as expected in 1.3?
SacoDesign is right. its not working as expected (or the cook book is wrong) - - Here is the same from cookbook ( http://book.cakephp.org/view/46/Routes-Configuration ) Another common use for the Router is to define an alias for a controller. Let's say that instead of accessing our regular URL at / users/someAction/5, we'd like to be able to access it by /cooks/ someAction/5. The following route easily takes care of that: Plain Text View Router::connect( '/cooks/:action/*', array('controller' = 'users', 'action' = 'index') ); This is telling the Router that any url beginning with /cooks/ should be sent to the users controller. It works fine except if there is no action specified that is the situation in which cake should default to index() function /cooks/action1 maps to users-action1() /cooks/action2 maps to users-action2() /cooks/index maps to users-index() *BUT* /cooks shows a CooksController missing error message On Aug 25, 6:05 pm, SacoDesign sign...@sacodesign.com wrote: Hello, I'm upgrading my app from 1.2 to 1.3. I have several custom routes setup like so: Router::connect('/blog/:action/*', array('controller'='news_articles', 'action'='index')); This works fine, except for when the url is only /blog/. In that case I get a cannot find blog controller error. Is this by design, or a bug? I can get it working by adding another route for: Router::connect('/blog', array('controller'='news_articles', 'action'='index')); but that seems wrong. Thanks, -Kevin Wentworth 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: Router::connect() not behaving as expected in 1.3?
Thanks for the response. I still cannot get the entire directory to respond as a controller without 2 router::connect() calls. I removed the 'action'='index' as suggested. Has anyone else experienced this issue? I removed every route from my routes.php and tried the following: Router::connect('/blog*', array('controller'='news_articles')); = missing 'BlogController' error; doesn't work for any request starting with /blog/ Router::connect('/blog/*', array('controller'='news_articles')); = /blog/ - shows index (working) = /blog/view/1/ - shows index; should show view() Router::connect('/blog/:action/*', array('controller'='news_articles')); = /blog/ - missing 'BlogController' error = /blog/view/1/ - working On Aug 25, 1:46 pm, DragonFlyEye dragonflyey...@gmail.com wrote: That all looks correct, and it would be the same in 1.2. You might write the following, though: Router::connect('/blog*', array('controller' = 'news_articles')); That would push all requests for the /blog directory to the right controller, then you can create the actions you want and they'll get filled in automatically since you didn't specify a pseudo-route for each one (which might get complicated). Cricket's right, though: by putting the pseudo route :action in there and then assigning the action 'index,' you're basically pushing every single request with a second (but no third) subdirectory in the URL to the same action. Seems like it's a bit inefficient? On Aug 25, 9:05 am, SacoDesign sign...@sacodesign.com wrote: Hello, I'm upgrading my app from 1.2 to 1.3. I have several custom routes setup like so: Router::connect('/blog/:action/*', array('controller'='news_articles', 'action'='index')); This works fine, except for when the url is only /blog/. In that case I get a cannot find blog controller error. Is this by design, or a bug? I can get it working by adding another route for: Router::connect('/blog', array('controller'='news_articles', 'action'='index')); but that seems wrong. Thanks, -Kevin Wentworth 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
Router::connect() not behaving as expected in 1.3?
Hello, I'm upgrading my app from 1.2 to 1.3. I have several custom routes setup like so: Router::connect('/blog/:action/*', array('controller'='news_articles', 'action'='index')); This works fine, except for when the url is only /blog/. In that case I get a cannot find blog controller error. Is this by design, or a bug? I can get it working by adding another route for: Router::connect('/blog', array('controller'='news_articles', 'action'='index')); but that seems wrong. Thanks, -Kevin Wentworth 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: Router::connect() not behaving as expected in 1.3?
On Wed, Aug 25, 2010 at 9:05 AM, SacoDesign sign...@sacodesign.com wrote: Hello, I'm upgrading my app from 1.2 to 1.3. I have several custom routes setup like so: Router::connect('/blog/:action/*', array('controller'='news_articles', 'action'='index')); This works fine, except for when the url is only /blog/. In that case I get a cannot find blog controller error. Is this by design, or a bug? I can get it working by adding another route for: Router::connect('/blog', array('controller'='news_articles', 'action'='index')); but that seems wrong. It looks correct to me. In the first route, you're saying, /blog, plus something, and maybe something else. Obviously, /blog alone doesn't match. But why are you directing all requests to the one action? 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: Router::connect() not behaving as expected in 1.3?
I expected that /blog/ would route to the news_articles controller (index action) like a call to /blog/index would do. This is the way it worked on 1.2. Now, on 1.3, a request for /blog/ looks for the blog controller. Is there any way to combine the two Router::connect()'s into one? To answer your question, I believe I am only specifying a default action if none is provided. On Aug 25, 1:25 pm, cricket zijn.digi...@gmail.com wrote: On Wed, Aug 25, 2010 at 9:05 AM, SacoDesign sign...@sacodesign.com wrote: Hello, I'm upgrading my app from 1.2 to 1.3. I have several custom routes setup like so: Router::connect('/blog/:action/*', array('controller'='news_articles', 'action'='index')); This works fine, except for when the url is only /blog/. In that case I get a cannot find blog controller error. Is this by design, or a bug? I can get it working by adding another route for: Router::connect('/blog', array('controller'='news_articles', 'action'='index')); but that seems wrong. It looks correct to me. In the first route, you're saying, /blog, plus something, and maybe something else. Obviously, /blog alone doesn't match. But why are you directing all requests to the one action? 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: Router::connect() not behaving as expected in 1.3?
That all looks correct, and it would be the same in 1.2. You might write the following, though: Router::connect('/blog*', array('controller' = 'news_articles')); That would push all requests for the /blog directory to the right controller, then you can create the actions you want and they'll get filled in automatically since you didn't specify a pseudo-route for each one (which might get complicated). Cricket's right, though: by putting the pseudo route :action in there and then assigning the action 'index,' you're basically pushing every single request with a second (but no third) subdirectory in the URL to the same action. Seems like it's a bit inefficient? On Aug 25, 9:05 am, SacoDesign sign...@sacodesign.com wrote: Hello, I'm upgrading my app from 1.2 to 1.3. I have several custom routes setup like so: Router::connect('/blog/:action/*', array('controller'='news_articles', 'action'='index')); This works fine, except for when the url is only /blog/. In that case I get a cannot find blog controller error. Is this by design, or a bug? I can get it working by adding another route for: Router::connect('/blog', array('controller'='news_articles', 'action'='index')); but that seems wrong. Thanks, -Kevin Wentworth 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
How to hide id with router::connect
I have a hyperlink defined as: echo $html-link(__('Discuss', true), array('controller' = 'cars', 'action'='view', $car['Car']['id'], $car['Car']['make'], $car['Car']['model'])); How can I define a route that changes the url from '/cars/view/14/nissan/maxima' to '/cars/nissan/maxima'?? I did Router::connect('/cars/*', array('controller'='cars', 'action' = 'view')) which got rid of the 'view' but not then I'm stuck with the 'id' I tried something like: Router::connect('/car/:make/:model', array('controller'='cars', 'action' = 'view'), array('pass' = array('id', 'make', 'model'))); but that didn't seem to hide the id. Any help would be much appreciated, thanks! -- View this message in context: http://www.nabble.com/How-to-hide-id-with-router%3A%3Aconnect-tp25273147p25273147.html Sent from the CakePHP mailing list archive at Nabble.com. --~--~-~--~~~---~--~~ 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: How to hide id with router::connect
The url is what tells cake what to do. If you hide the id you remove the id and Cake will have not idea what id you want. The url must contain some kind of unique identifier...but not specifically the numeric id from the database. You need to alter your action so it can use the make and model names to locate the car you want. Look at the footer of your post. The nabble url does not contain a numeric id but rather a readable name for the post. This is usually called a slug. Do a search on that word and you will find a lot of nice stuff like a behaviour to help you out and Cake classes helping you out with generating unique names for items in your database. You can either make a full slug for each car or one set of slugs for makes and one for models... hoping that noone makes two cars of the same name. /Martin On Sep 3, 12:15 pm, hahmadi82 hahmad...@gmail.com wrote: I have a hyperlink defined as: echo $html-link(__('Discuss', true), array('controller' = 'cars', 'action'='view', $car['Car']['id'], $car['Car']['make'], $car['Car']['model'])); How can I define a route that changes the url from '/cars/view/14/nissan/maxima' to '/cars/nissan/maxima'?? I did Router::connect('/cars/*', array('controller'='cars', 'action' = 'view')) which got rid of the 'view' but not then I'm stuck with the 'id' I tried something like: Router::connect('/car/:make/:model', array('controller'='cars', 'action' = 'view'), array('pass' = array('id', 'make', 'model'))); but that didn't seem to hide the id. Any help would be much appreciated, thanks! -- View this message in context:http://www.nabble.com/How-to-hide-id-with-router%3A%3Aconnect-tp25273... Sent from the CakePHP mailing list archive at Nabble.com. --~--~-~--~~~---~--~~ 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: Router Connect
Look into admin routing in the cakephp cookbook. Cheers, Adam On Jun 19, 12:44 pm, thatsgreat2345 thatsgreat2...@gmail.com wrote: I'm a little confused by routes at the moment. Currently I have an admin structure where each function such as function users($load = null, $id = null) { $this-viewPath = 'admins/users'; switch ($load) { Case 'add': $this-render('add'); break; Changing the viewpath each time, and adding in the render is annoying. I'm curious if there is any way to fix this with routes, as the url would look like /admins/users/add/ but after searching can't seem to see how to do this. I was thinking that maybe I could create some sort of beforeFilter and have it do it then except I think routers would be a better fit. --~--~-~--~~~---~--~~ 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: Router Connect
This is the link to the corresponding chapter in the cookbook Adam mentions: http://book.cakephp.org/view/544/Prefix-Routing Hope that helps, Markus --~--~-~--~~~---~--~~ 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: Webroot and prefix in Router::connect()
Hey Adam. I actually trashed that idea when I noticed it was causing me problems elsewhere. You are right that everything seems to work without prepending this /fb/ to my URLs... except the webroot stuff :) On Jun 17, 11:57 pm, Adam Royle a...@sleekgeek.com.au wrote: I see from a previous email you overrode your AppHelper to automatically prepend /fb onto all of your links which is causing the prob. Short of re-writing your links everywhere, you could modify this method so absolute files are not prepended with /fb. Cheers, Adam - Original Message - From: Greg Baker greg.baker@gmail.com To: CakePHP cake-php@googlegroups.com Sent: Thursday, June 18, 2009 10:51 AM Subject: Webroot and prefix in Router::connect() I am working on my facebook app (you may have seen other messages here by me about this) and I have hit another small problem. Having set up my routing so that I may enter my app either via facebook or via a webpage I find that I cannot access files in the folders in my webroot in facebook. For example, some of my routes: Router::connect('/fb', array('controller'='pages', 'action'='display', 'facebook'=true, 'canvas')); Router::connect('/fb/help', array('controller'='pages', 'action'='display', 'facebook'=true, 'help')); Router::connect('/fb/:controller/:action/*', array ('facebook'=true)); Router::connect('/', array('controller'='pages', 'action'='display', 'canvas')); Router::connect('/help', array('controller'='pages', 'action'='display', 'help')); Now facebook hits my app using /fb/whatever. This works so far for everything except for my .swf files which reside in my webroot/flash directory./ If I go to /flash/flash.swf I get my file If I go to /fb/flash/flash.swf it looks for a FlashController. I am so close to getting this working just as I need it. I think this will be my last snag. --~--~-~--~~~---~--~~ 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 Connect
I'm a little confused by routes at the moment. Currently I have an admin structure where each function such as function users($load = null, $id = null) { $this-viewPath = 'admins/users'; switch ($load) { Case 'add': $this-render('add'); break; Changing the viewpath each time, and adding in the render is annoying. I'm curious if there is any way to fix this with routes, as the url would look like /admins/users/add/ but after searching can't seem to see how to do this. I was thinking that maybe I could create some sort of beforeFilter and have it do it then except I think routers would be a better fit. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Webroot and prefix in Router::connect()
I am working on my facebook app (you may have seen other messages here by me about this) and I have hit another small problem. Having set up my routing so that I may enter my app either via facebook or via a webpage I find that I cannot access files in the folders in my webroot in facebook. For example, some of my routes: Router::connect('/fb', array('controller'='pages', 'action'='display', 'facebook'=true, 'canvas')); Router::connect('/fb/help', array('controller'='pages', 'action'='display', 'facebook'=true, 'help')); Router::connect('/fb/:controller/:action/*', array ('facebook'=true)); Router::connect('/', array('controller'='pages', 'action'='display', 'canvas')); Router::connect('/help', array('controller'='pages', 'action'='display', 'help')); Now facebook hits my app using /fb/whatever. This works so far for everything except for my .swf files which reside in my webroot/flash directory./ If I go to /flash/flash.swf I get my file If I go to /fb/flash/flash.swf it looks for a FlashController. I am so close to getting this working just as I need it. I think this will be my last snag. --~--~-~--~~~---~--~~ 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: Webroot and prefix in Router::connect()
I see from a previous email you overrode your AppHelper to automatically prepend /fb onto all of your links which is causing the prob. Short of re-writing your links everywhere, you could modify this method so absolute files are not prepended with /fb. Cheers, Adam - Original Message - From: Greg Baker greg.baker@gmail.com To: CakePHP cake-php@googlegroups.com Sent: Thursday, June 18, 2009 10:51 AM Subject: Webroot and prefix in Router::connect() I am working on my facebook app (you may have seen other messages here by me about this) and I have hit another small problem. Having set up my routing so that I may enter my app either via facebook or via a webpage I find that I cannot access files in the folders in my webroot in facebook. For example, some of my routes: Router::connect('/fb', array('controller'='pages', 'action'='display', 'facebook'=true, 'canvas')); Router::connect('/fb/help', array('controller'='pages', 'action'='display', 'facebook'=true, 'help')); Router::connect('/fb/:controller/:action/*', array ('facebook'=true)); Router::connect('/', array('controller'='pages', 'action'='display', 'canvas')); Router::connect('/help', array('controller'='pages', 'action'='display', 'help')); Now facebook hits my app using /fb/whatever. This works so far for everything except for my .swf files which reside in my webroot/flash directory./ If I go to /flash/flash.swf I get my file If I go to /fb/flash/flash.swf it looks for a FlashController. I am so close to getting this working just as I need it. I think this will be my last snag. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
what this function does Router::connect()
I am using WizardComponent, can anybody tell me wot the following function does and where it should be placed. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: what this function does Router::connect()
http://book.cakephp.org/view/542/Defining-Routes On Fri, Oct 24, 2008 at 9:48 AM, xelios [EMAIL PROTECTED] wrote: I am using WizardComponent, can anybody tell me wot the following function does and where it should be placed. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: what this function does Router::connect()
Thx On Oct 24, 5:07 pm, Dardo Sordi Bogado [EMAIL PROTECTED] wrote: http://book.cakephp.org/view/542/Defining-Routes On Fri, Oct 24, 2008 at 9:48 AM, xelios [EMAIL PROTECTED] wrote: I am using WizardComponent, can anybody tell me wot the following function does and where it should be placed. --~--~-~--~~~---~--~~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Routing Question how to use Router::connect('/') with session_id?
Capturing sessionID with a route is my wrong knowledge as you say. I understand sessionID is not url but GET query. And (in my controller) $this-Session-read() is automatically read session value from GET query sessionID. Thank you. the issue you're seeing has been fixed there. 'the issue' is what's issue? update to 1.2.x.x rev6418, but I get same error. when I access '/?CAKEPHP=e233bd9c1facda8084d8ba2f2226eb60' I get this error: Error: CAKEPHPe233bd9c1facda8084d8ba2f2226eb60Controller could not be found. 'the issue' is not this? Sorry to keep asking questions. On Jan 29, 9:45 am, nate [EMAIL PROTECTED] wrote: You can't capture the session ID with a route, because it's a GET variable, it's not part of the URL. Try $_GET['CAKEPHP'] or (in your controller) $this-params['url']['CAKEPHP']. Also, update to the latest branch code, because the issue you're seeing has been fixed there. On Jan 28, 11:52 pm, sanemat [EMAIL PROTECTED] wrote: Thank you for your reply. I use cookie to use session for visitor who accept cookie. The way use sessionIDs in the URL is bad as you say, but most of mobilephone users in my country can not accept cookie. And 'set use_trans_sid=1' adds sessionID in all url link for my site. On Jan 29, 1:53 am, MrTufty [EMAIL PROTECTED] wrote: I might not be understanding this properly - but WHY would you want to stick session IDs in the URL? It's just about the worst thing you could ever do for SEO. Steve On Jan 28, 12:38 pm, sanemat [EMAIL PROTECTED] wrote: I am wordering how to get url to work: /?CAKEPHP=session_id Here is my route in app/config/routes.php: Router::connect('/', array('controller' = 'pages', 'action' = 'display')); When I access '/', it call '/pages/display', As I expected. But when I set disable cookie and set use_trans_sid=1, I get problem. In my expectation, '/?CAKEPHP=session_id' call '/pages/display/? CAKEPHP=session_id'. Contrary my expectation, when I access '/? CAKEPHP=e233bd9c1facda8084d8ba2f2226eb60' I get this error: Error: CAKEPHPe233bd9c1facda8084d8ba2f2226eb60Controller could not be found. Please tell me how to get url to work '/?CAKEPHP=session_id'. I use CakePHP 1.2.x.x thanks --~--~-~--~~~---~--~~ 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: Routing Question how to use Router::connect('/') with session_id?
You can't capture the session ID with a route, because it's a GET variable, it's not part of the URL. Try $_GET['CAKEPHP'] or (in your controller) $this-params['url']['CAKEPHP']. Also, update to the latest branch code, because the issue you're seeing has been fixed there. On Jan 28, 11:52 pm, sanemat [EMAIL PROTECTED] wrote: Thank you for your reply. I use cookie to use session for visitor who accept cookie. The way use sessionIDs in the URL is bad as you say, but most of mobilephone users in my country can not accept cookie. And 'set use_trans_sid=1' adds sessionID in all url link for my site. On Jan 29, 1:53 am, MrTufty [EMAIL PROTECTED] wrote: I might not be understanding this properly - but WHY would you want to stick session IDs in the URL? It's just about the worst thing you could ever do for SEO. Steve On Jan 28, 12:38 pm, sanemat [EMAIL PROTECTED] wrote: I am wordering how to get url to work: /?CAKEPHP=session_id Here is my route in app/config/routes.php: Router::connect('/', array('controller' = 'pages', 'action' = 'display')); When I access '/', it call '/pages/display', As I expected. But when I set disable cookie and set use_trans_sid=1, I get problem. In my expectation, '/?CAKEPHP=session_id' call '/pages/display/? CAKEPHP=session_id'. Contrary my expectation, when I access '/? CAKEPHP=e233bd9c1facda8084d8ba2f2226eb60' I get this error: Error: CAKEPHPe233bd9c1facda8084d8ba2f2226eb60Controller could not be found. Please tell me how to get url to work '/?CAKEPHP=session_id'. I use CakePHP 1.2.x.x thanks --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Routing Question how to use Router::connect('/') with session_id?
I am wordering how to get url to work: /?CAKEPHP=session_id Here is my route in app/config/routes.php: Router::connect('/', array('controller' = 'pages', 'action' = 'display')); When I access '/', it call '/pages/display', As I expected. But when I set disable cookie and set use_trans_sid=1, I get problem. In my expectation, '/?CAKEPHP=session_id' call '/pages/display/? CAKEPHP=session_id'. Contrary my expectation, when I access '/? CAKEPHP=e233bd9c1facda8084d8ba2f2226eb60' I get this error: Error: CAKEPHPe233bd9c1facda8084d8ba2f2226eb60Controller could not be found. Please tell me how to get url to work '/?CAKEPHP=session_id'. I use CakePHP 1.2.x.x thanks --~--~-~--~~~---~--~~ 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: Routing Question how to use Router::connect('/') with session_id?
Have you tried this? ---cut here--- Router::connect('/', array('controller' = 'pages', 'action' = 'display')); Router::connect('/*', array('controller' = 'pages', 'action' = 'display')); ---cut here--- On 28 Sty, 13:38, sanemat [EMAIL PROTECTED] wrote: I am wordering how to get url to work: /?CAKEPHP=session_id Here is my route in app/config/routes.php: Router::connect('/', array('controller' = 'pages', 'action' = 'display')); When I access '/', it call '/pages/display', As I expected. But when I set disable cookie and set use_trans_sid=1, I get problem. In my expectation, '/?CAKEPHP=session_id' call '/pages/display/? CAKEPHP=session_id'. Contrary my expectation, when I access '/? CAKEPHP=e233bd9c1facda8084d8ba2f2226eb60' I get this error: Error: CAKEPHPe233bd9c1facda8084d8ba2f2226eb60Controller could not be found. Please tell me how to get url to work '/?CAKEPHP=session_id'. I use CakePHP 1.2.x.x thanks --~--~-~--~~~---~--~~ 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: Routing Question how to use Router::connect('/') with session_id?
I might not be understanding this properly - but WHY would you want to stick session IDs in the URL? It's just about the worst thing you could ever do for SEO. Steve On Jan 28, 12:38 pm, sanemat [EMAIL PROTECTED] wrote: I am wordering how to get url to work: /?CAKEPHP=session_id Here is my route in app/config/routes.php: Router::connect('/', array('controller' = 'pages', 'action' = 'display')); When I access '/', it call '/pages/display', As I expected. But when I set disable cookie and set use_trans_sid=1, I get problem. In my expectation, '/?CAKEPHP=session_id' call '/pages/display/? CAKEPHP=session_id'. Contrary my expectation, when I access '/? CAKEPHP=e233bd9c1facda8084d8ba2f2226eb60' I get this error: Error: CAKEPHPe233bd9c1facda8084d8ba2f2226eb60Controller could not be found. Please tell me how to get url to work '/?CAKEPHP=session_id'. I use CakePHP 1.2.x.x thanks --~--~-~--~~~---~--~~ 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: Routing Question how to use Router::connect('/') with session_id?
Thank you for your reply. But '/*' matches all url like '/posts/add' '/comments/edit/2', all request calls '/pages/display'. And I tried this. Router::connect('/:sesseionID', array('controller' = 'pages', 'action' = 'display', '?' = 'sessionID'), array('sessionID' = '(?:\? (.*))')); I try capturing sessionID. But I get another error: Warning (2): strpos() [function.strpos]: Empty delimiter. [CORE\cake \dispatcher.php, line 607] On Jan 28, 11:52 pm, Marcin Jaworski [EMAIL PROTECTED] wrote: Have you tried this? ---cut here--- Router::connect('/', array('controller' = 'pages', 'action' = 'display')); Router::connect('/*', array('controller' = 'pages', 'action' = 'display')); ---cut here--- On 28 Sty, 13:38, sanemat [EMAIL PROTECTED] wrote: I am wordering how to get url to work: /?CAKEPHP=session_id Here is my route in app/config/routes.php: Router::connect('/', array('controller' = 'pages', 'action' = 'display')); When I access '/', it call '/pages/display', As I expected. But when I set disable cookie and set use_trans_sid=1, I get problem. In my expectation, '/?CAKEPHP=session_id' call '/pages/display/? CAKEPHP=session_id'. Contrary my expectation, when I access '/? CAKEPHP=e233bd9c1facda8084d8ba2f2226eb60' I get this error: Error: CAKEPHPe233bd9c1facda8084d8ba2f2226eb60Controller could not be found. Please tell me how to get url to work '/?CAKEPHP=session_id'. I use CakePHP 1.2.x.x thanks --~--~-~--~~~---~--~~ 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: Routing Question how to use Router::connect('/') with session_id?
Thank you for your reply. I use cookie to use session for visitor who accept cookie. The way use sessionIDs in the URL is bad as you say, but most of mobilephone users in my country can not accept cookie. And 'set use_trans_sid=1' adds sessionID in all url link for my site. On Jan 29, 1:53 am, MrTufty [EMAIL PROTECTED] wrote: I might not be understanding this properly - but WHY would you want to stick session IDs in the URL? It's just about the worst thing you could ever do for SEO. Steve On Jan 28, 12:38 pm, sanemat [EMAIL PROTECTED] wrote: I am wordering how to get url to work: /?CAKEPHP=session_id Here is my route in app/config/routes.php: Router::connect('/', array('controller' = 'pages', 'action' = 'display')); When I access '/', it call '/pages/display', As I expected. But when I set disable cookie and set use_trans_sid=1, I get problem. In my expectation, '/?CAKEPHP=session_id' call '/pages/display/? CAKEPHP=session_id'. Contrary my expectation, when I access '/? CAKEPHP=e233bd9c1facda8084d8ba2f2226eb60' I get this error: Error: CAKEPHPe233bd9c1facda8084d8ba2f2226eb60Controller could not be found. Please tell me how to get url to work '/?CAKEPHP=session_id'. I use CakePHP 1.2.x.x thanks --~--~-~--~~~---~--~~ 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: Regular expression in Router::connect
On 15.05.2007 02:50 Aaron Shafovaloff wrote: I figured it out: Router::connect('/:group/:curriculum/*', array('controller'='curriculum'),array('curriculum'='\b(?:(?! curriculum|courses|facilitators|configuration)\w)+\b')); Your parens are off. The negative lookahead assertions should group all the alternatives, so try: \b(?!(?:curriculum|courses|facilitators|configuration))\w+\b -Matt --~--~-~--~~~---~--~~ 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: Regular expression in Router::connect
By the way, I need it to exclude multiple strings. So something to the effect of: Router::connect('/:group/:curriculum/*', array('controller'='curriculum'),array('curriculum'='!xyz AND !abc AND !mno')); On May 14, 3:38 pm, Aaron Shafovaloff [EMAIL PROTECTED] wrote: With Router::connect I'd like to use a regular expression that would say the curriculum cannot be xyz' . Shouldn't this work? Router::connect('/:group/:curriculum/*', array('controller'='curriculum'),array('curriculum'='!xyz')); --~--~-~--~~~---~--~~ 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: Regular expression in Router::connect
Wooo hoo! I figured it out: Router::connect('/:group/:curriculum/*', array('controller'='curriculum'),array('curriculum'='\b(?:(?! curriculum|courses|facilitators|configuration)\w)+\b')); Thanks to: http://www.roscripts.com/PHP_regular_expressions_examples-136.html On May 14, 3:38 pm, Aaron Shafovaloff [EMAIL PROTECTED] wrote: With Router::connect I'd like to use a regular expression that would say the curriculum cannot be xyz' . Shouldn't this work? Router::connect('/:group/:curriculum/*', array('controller'='curriculum'),array('curriculum'='!xyz')); --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---