Re: Route is overwriting routes of same controller
Your route definition will direct all URL starting with /catalogs/ to be directed to your catalog_groups controller. Thus if you also have a catalogs controller, then no URL will reach that controller. Note that the URL you are redirecting to the catalog_groups controller, does not need to start with a real controllers' name. You could use other words instead of catalogs. Did the above help you solve your issue? Enjoy, John On Monday, 28 December 2015 11:31:33 UTC+2, Sven Mäurer wrote: > > Is it right that all other routes of the same controller are overwritten > if I define the following? > > Router::connect( > '/catalogs/:name', > ['controller' => 'catalog_groups', 'action' => 'view'], > ['name' => '[a-zA-Z0-9]+(?:-[a-zA-Z0-9]+)*'] > ); > > I am using CakePHP 2.7.* > -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at https://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Route is overwriting routes of same controller
Is it right that all other routes of the same controller are overwritten if I define the following? Router::connect( '/catalogs/:name', ['controller' => 'catalog_groups', 'action' => 'view'], ['name' => '[a-zA-Z0-9]+(?:-[a-zA-Z0-9]+)*'] ); I am using CakePHP 2.7.* -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at https://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Custom routes preventing modle loading
Hi, I have a controller (Stops) that is accessed through a custom route. When I try to access a page I get errors about calling functions on a boolean. It turns out that $this->Stops is set to false. To get my functions to work properly I have to add $this->loadModel("Stops"); to my functions, even though this should be loaded automatically (to the best of my knowledge). Is there something I have neglected to do in my code which is causing this? -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups "CakePHP" group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
3.0 -- Pagination Helper with Custom Routes causes Missing Route Exception!
I'm trying to use the pagination helper, but it's causing missing route exception when used with any method that tries to generate a link. my route code looks like this: Router::prefix('manage', function ($routes) { $routes-connect('/:organizationNeedle',['controller'='Organizations','action' = 'dashboard']); $routes-connect('/:organizationNeedle/:controller',['action' = 'index']); $routes-connect('/:organizationNeedle/:controller/:action/*'); }); The error I get is: *Error: *A route matching array ( 'page' = NULL, 'action' = 'index', 'prefix' = 'manage', 'plugin' = NULL, 'controller' = 'Containers', '_ext' = NULL, ) could not be found. None of the currently connected routes match the given URL or parameters. Add a matching route to config\routes.php The passed context was: [ '_base' = '', '_port' = '80', '_scheme' = 'http', '_host' = 'vlife.v4', 'params' = [ 'plugin' = null, 'controller' = 'Containers', 'action' = 'index', '_ext' = null, 'pass' = [], 'organizationNeedle' = 'test', 'prefix' = 'manage', 'paging' = [ 'Containers' = [ [maximum depth reached] ] ] ] ] If anyone has any ideas on how to fix this, I'd love to hear it. I've raked through the router api and paginator api for both the component and the helper and I'm not seeing a way to make this work. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
CakePHP routes always pointing to same action
I am facing some problems in routing under cakephp there are two actions in my controller they are as below: example.com/posts/show/show-by-day example.com/posts/view/slug-post I want them as: example.com/article/show-by-day.html example.com/article/slug-post.html So i routes file under config file I wrote as: Router::connect('/article/:show_by_day', array('controller' = 'posts', 'action' = 'show'), array('pass' = array('show_by_day'))); Router::connect('/article/:slug', array('controller' = 'posts', 'action' = 'view'), array('pass' = array('slug'))); its working fine when I hit the url example.com/article/show-by-day.html but when I hit url example.com/article/slug-post.html , its again point to action show. So how can I solve it? Many thanks! -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: CakePHP routes always pointing to same action
Amendment! If you really have a slug in the second URL, then please amend the routing to: Router::connect('/article/slug-post/:slug', ... rest of your definition...); Enjoy, John On Wednesday, 7 January 2015 21:13:12 UTC+2, John Andersen wrote: Both your route configurations points to that the URL /article follows by a parameter, so in your case only the first is used. Change them as follows: Router::connect('/article/show_by_day', ...rest of your definition ...); Router::connect('/article/slug-post', ...rest of your definition...); Kindly inform us whether or not that solved your problem :) Enjoy, John On Wednesday, 7 January 2015 03:34:43 UTC+2, Lợi Nguyễn Đình wrote: I am facing some problems in routing under cakephp there are two actions in my controller they are as below: example.com/posts/show/show-by-day example.com/posts/view/slug-post I want them as: example.com/article/show-by-day.html example.com/article/slug-post.html So i routes file under config file I wrote as: Router::connect('/article/:show_by_day', array('controller' = 'posts', 'action' = 'show'), array('pass' = array('show_by_day'))); Router::connect('/article/:slug', array('controller' = 'posts', 'action' = 'view'), array('pass' = array('slug'))); its working fine when I hit the url example.com/article/show-by-day.html but when I hit url example.com/article/slug-post.html , its again point to action show. So how can I solve it? Many thanks! -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: CakePHP routes always pointing to same action
Both your route configurations points to that the URL /article follows by a parameter, so in your case only the first is used. Change them as follows: Router::connect('/article/show_by_day', ...rest of your definition ...); Router::connect('/article/slug-post', ...rest of your definition...); Kindly inform us whether or not that solved your problem :) Enjoy, John On Wednesday, 7 January 2015 03:34:43 UTC+2, Lợi Nguyễn Đình wrote: I am facing some problems in routing under cakephp there are two actions in my controller they are as below: example.com/posts/show/show-by-day example.com/posts/view/slug-post I want them as: example.com/article/show-by-day.html example.com/article/slug-post.html So i routes file under config file I wrote as: Router::connect('/article/:show_by_day', array('controller' = 'posts', 'action' = 'show'), array('pass' = array('show_by_day'))); Router::connect('/article/:slug', array('controller' = 'posts', 'action' = 'view'), array('pass' = array('slug'))); its working fine when I hit the url example.com/article/show-by-day.html but when I hit url example.com/article/slug-post.html , its again point to action show. So how can I solve it? Many thanks! -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Problem with creating routes
I have a simple project that I'm trying to convert to a CakePHP project: http://optiekcardoen.be/home The page navigation is very simple: - Home (/) - Shop (/shop) - Products (/products) - Frames (/products/frames) - Sunglasses (/products/sunglasses) - Lenses (/products/lenses) - Hearing aids (/products/hearing-aids) - Glass (/products/glass) - Optometry (/products/optometry) - Discounts (/discounts) - Facts (/facts) - Fotoshoots (/fotoshoots) - Contact (/contact) This is my current .htaccess file where I do the routing: Options +FollowSymLinks RewriteEngine On RewriteBase / RewriteRule ^home$ index.php RewriteRule ^producten/([^/\.]+)$ $1.php RewriteRule ^([^/\.]+)$ $1.php In CakePHP, routing should happen in app/Config/routes.php. Here's my attempt to fit the current routing in the CakePHP routing: Router::connect('/', array('controller' = 'pages', 'action' = 'display', 'home')); Router::connect('/*', array('controller' = 'pages', 'action' = 'display' )); Router::connect('/producten/:product-type', array('controller' = 'pages', 'action' = 'display'), array('pass' = array('product-type')) ); Unfortunately, I get errors when I try to reach the product detail pages (e.g. /products/frames): Missing View *Error: *The view for *PagesController::**display()* was not found. *Error: *Confirm you have created the file: D:\Websites\Optiek Cardoen\05 - Cake\app\View\Pages\producten\monturen.ctp *Notice: *If you want to customize this error message, create app\View\Errors\missing_view.ctp It says that the last rule in routes.php isn't correct, but how can I make it work to fill my needs? Thanks in advance! -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Browser caching routes (3.0)
I have a small request. I struggled getting my routes to work properly because firefox was caching routes. Could you please put a note near the beginning of the cache documentation to warn people to turn browser cache off. Here is how you do it in firefox: 1. Enter about:config in url. 2. Search for cache. 3. Disable network.http.use-cache I had a really tough time figuring out why things were not working as expected and it turned out to be a browser issue. A small note on this could help a lot of other people avoid the same pitfall. Thanks. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Getting rid of CakePHP's default routes.
Open the app/Config/routes.php file and comment or erase this line (should be at the bottom of the file) *require CAKE . 'Config' . DS . 'routes.php';* Remember to define your routes otherwise this won't work well. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
3.0alpha1: Recent commit removes default Routes
i did a Composer update last night my project exploded. Turns out a [recent commit https://github.com/cakephp/cakephp/commit/a30f1c505c4a69bb4abb94d5b1d7aec1ffbd7015] removed /src/Config/routes.php. Being new to programming within a framework, comprehending dealing with routes is still a couple steps down the road for me. So i managed to get my project working again: 1. In App/Config/routes.php i had to comment the line at the end reading require CAKE . 'Config/routes.php'; 2. After scanning the commit in the link above, found this line Router::connect('/:controller/:action/*', [], ['defaultRoute' = true, 'routeClass' = 'Cake\Routing\Route\InflectedRoute']); and added it after the line i commented. Now, my site is working, for now, but i know there's a lot of stuff i left out from the original default routes file. My question is, based on the changes that remove the default routes, what's the new *Right Way* to do this? Did i miss something obvious, or should i be looking for new documentation somewhere? Thanks. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: 3.0alpha1: Recent commit removes default Routes
The question was answered in the linked commit comments On Saturday, July 5, 2014 8:42:15 PM UTC+2, Joe Theuerkauf wrote: i did a Composer update last night my project exploded. Turns out a [recent commit https://github.com/cakephp/cakephp/commit/a30f1c505c4a69bb4abb94d5b1d7aec1ffbd7015] removed /src/Config/routes.php. Being new to programming within a framework, comprehending dealing with routes is still a couple steps down the road for me. So i managed to get my project working again: 1. In App/Config/routes.php i had to comment the line at the end reading require CAKE . 'Config/routes.php'; 2. After scanning the commit in the link above, found this line Router::connect('/:controller/:action/*', [], ['defaultRoute' = true, 'routeClass' = 'Cake\Routing\Route\InflectedRoute']); and added it after the line i commented. Now, my site is working, for now, but i know there's a lot of stuff i left out from the original default routes file. My question is, based on the changes that remove the default routes, what's the new *Right Way* to do this? Did i miss something obvious, or should i be looking for new documentation somewhere? Thanks. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Re: 3.0alpha1: Recent commit removes default Routes
New documentation is here http://book.cakephp.org/3.0/en/development/routing.html#routes-configuration On Saturday, July 5, 2014 8:42:15 PM UTC+2, Joe Theuerkauf wrote: i did a Composer update last night my project exploded. Turns out a [recent commit https://github.com/cakephp/cakephp/commit/a30f1c505c4a69bb4abb94d5b1d7aec1ffbd7015] removed /src/Config/routes.php. Being new to programming within a framework, comprehending dealing with routes is still a couple steps down the road for me. So i managed to get my project working again: 1. In App/Config/routes.php i had to comment the line at the end reading require CAKE . 'Config/routes.php'; 2. After scanning the commit in the link above, found this line Router::connect('/:controller/:action/*', [], ['defaultRoute' = true, 'routeClass' = 'Cake\Routing\Route\InflectedRoute']); and added it after the line i commented. Now, my site is working, for now, but i know there's a lot of stuff i left out from the original default routes file. My question is, based on the changes that remove the default routes, what's the new *Right Way* to do this? Did i miss something obvious, or should i be looking for new documentation somewhere? Thanks. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/d/optout.
Paginator and multilingual routes
Hello. I have a problem with paginator helper. I'm developing an app in 2 language versions. The app conatains among others blog, which is paginated. Now, the url's in routes.php look for exmaple like this: Router::connect('/blog/search/*', array('controller' = 'blog_categories', 'action' = 'search')); Router::connect('/blog/suche/*', array('controller' = 'blog_categories', 'action' = 'search')); This is the route for blog search option. Now, when I'm on a blog search results page, and I'm on the English version of website - everything works fine. The URLs of pages look like /blog/search/2, /blog/search/3 etc. But when I switch to German version, the paginator URLs are the same... and I want them to also be translated and look like: /blog/suche/2, /blog/suche/3, etc. I guess it is because the '/blog/search/*' is defined first. When I remove that line from routes.php - the /blog/suche/ links are in pagination. How to fix this? In such way that in the german version, paginated links will also be german? Regards and many thanks for help. Anna -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: Paginator and multilingual routes
You would need something else to differentiate the language used for the reverse routing. Router::connect('/blog/search/*', array('controller' = 'blog_categories', 'action' = 'search', 'lang' = 'en')); Router::connect('/blog/suche/*', array('controller' = 'blog_categories', 'action' = 'search', 'lang' = 'de')); That's just a really rough stab at the kind of thing you would need to do. Whether or not you can actually have lang in there (perhaps as a registered segment), is something you'd need to work out. Regards Reuben Helms On Wednesday, 2 October 2013 21:13:35 UTC+10, Anna P wrote: Hello. I have a problem with paginator helper. I'm developing an app in 2 language versions. The app conatains among others blog, which is paginated. Now, the url's in routes.php look for exmaple like this: Router::connect('/blog/search/*', array('controller' = 'blog_categories', 'action' = 'search')); Router::connect('/blog/suche/*', array('controller' = 'blog_categories', 'action' = 'search')); This is the route for blog search option. Now, when I'm on a blog search results page, and I'm on the English version of website - everything works fine. The URLs of pages look like /blog/search/2, /blog/search/3 etc. But when I switch to German version, the paginator URLs are the same... and I want them to also be translated and look like: /blog/suche/2, /blog/suche/3, etc. I guess it is because the '/blog/search/*' is defined first. When I remove that line from routes.php - the /blog/suche/ links are in pagination. How to fix this? In such way that in the german version, paginated links will also be german? Regards and many thanks for help. Anna -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php. For more options, visit https://groups.google.com/groups/opt_out.
Re: Routes and multilanguage site
Another tip. bootstrap: Configure::write('Config.languages', array('eng','ned', 'deu')); routes: $lang_regexp = implode('|', Configure::read('Config.languages')); Now you can use the following without having to repeat your list of langs: 'language' = $lang_regexp, On Thu, May 30, 2013 at 4:12 AM, iFemke femkevgem...@gmail.com wrote: That worked! Thanks! I feel so stupid now haha. We tried so many things and in the maintime it would all have worked if we had just put that part below everything else. Op donderdag 30 mei 2013 08:28:02 UTC+2 schreef Bogdan Soos het volgende: Hi there, Try changing the order, nothing is being routed after your first rule, at least move the first rule at the end, that should be your last rule. Regards, Bogdan. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: php cms and rewriteRule and cakephp routes
You should put the piwik folder inside your webroot/ folder. CakePHP directly serves any files inside webroot without parsing them through it's internal router. On Monday, 20 May 2013 05:22:07 UTC+2, Mehrdad Dadkhah wrote: hi I have this folders in the host root: app lib plugins vendors piwik piwik is a php cms (just php no framework) but this address (mySite.com/piwik) don't go to /piwik folder and wan't to use rewriteRule and cakephp routes for it I try lot of htaccess codes to resolve it but it didn't work somthing like: IfModule mod_rewrite.c RewriteEngine on RewriteCond %{REQUEST_URI} !^/piwik/ RewriteRule^piwik -[L] RewriteRule^$ app/webroot/[L] RewriteRule(.*) app/webroot/$1 [L] /IfModule and how can resolve this problem? thanks in advance -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Routes and multilanguage site
Hi there, Try changing the order, nothing is being routed after your first rule, at least move the first rule at the end, that should be your last rule. Regards, Bogdan. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Routes and multilanguage site
That worked! Thanks! I feel so stupid now haha. We tried so many things and in the maintime it would all have worked if we had just put that part below everything else. Op donderdag 30 mei 2013 08:28:02 UTC+2 schreef Bogdan Soos het volgende: Hi there, Try changing the order, nothing is being routed after your first rule, at least move the first rule at the end, that should be your last rule. Regards, Bogdan. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: php cms and rewriteRule and cakephp routes
We use our own CMS with CakePHP websites (we're currently translating our own cms into a new cakephp cms.). We use the same structure as you, (app, lib, plugins, vendors, cms) and we don't do anything with the .htaccess files inside the cakephp part (we also use routes, but don't create a /cms route especially). We do have this inside our cms map in the .htaccess: RewriteEngine On RewriteBase / RewriteRule ^(.*)/(.*)/(.*)/(.*)/(.*)/$ cms/?module=$1page=$2pagenumber=$3get4=$4get5=$5 [L] RewriteRule ^(.*)/(.*)/(.*)/(.*)/$ cms/?module=$1page=$2pagenumber=$3get4=$4 [L] RewriteRule ^(.*)/(.*)/(.*)/$ cms/?module=$1page=$2pagenumber=$3 [L] RewriteRule ^(.*)/(.*)/$ cms/?module=$1page=$2 [L] RewriteRule ^(.*)/$ cms/?module=$1 [L] We can access our cms at websitename.com/cms. I hope something like this will also work for you! -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Routes and multilanguage site
Hi, We have a problem with routes and our multilanguage site. We tried different salutions, but we can't get it to work. We have set it up like this: Router::connect('/', array('controller' = 'pages', 'action' = 'display', 'home')); Router::connect('/:language', array('controller' = 'pages', 'action' = 'display', 'home'), array('language' = 'eng|ned|deu')); Router::connect('/:language/:controller/:action/*', array(), array('language' = '[a-z]{3}')); But we can't get the other urls to change, for example: Router::connect('/:language/portfolio', array('controller' = 'portfolioitems', 'action' = 'index'), array('language' = 'eng|ned|deu')); This doesn't work. What are we doing wrong? Or how do we need to set things up? --- A more complicated question, is it possible to get 3 different urls from the same controller for the 3 different languages? For example (newsitems controller): websitename.com/eng/news websitename.com/ned/nieuws websitename.com/deu/nachrichten If someone knows this, please share! But it is more important for us to get the first part of my question working. If you have any question to make it more clear, please ask! I will try to answer as best as I can. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: php cms and rewriteRule and cakephp routes
thanks I use it IfModule mod_rewrite.c RewriteEngine on RewriteCond %{REQUEST_URI} !^/piwik/* RewriteRule^$ app/webroot/[L] RewriteCond %{REQUEST_URI} !^/piwik/* RewriteRule(.*) app/webroot/$1 [L] /IfModule and it's work -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: php cms and rewriteRule and cakephp routes
Just put another .htaccess witch has it´s own rewriteRules inside piwik folder, OR, put this piwik folder inside /app/webroot folder Em segunda-feira, 20 de maio de 2013 00h22min07s UTC-3, Mehrdad Dadkhah escreveu: hi I have this folders in the host root: app lib plugins vendors piwik piwik is a php cms (just php no framework) but this address (mySite.com/piwik) don't go to /piwik folder and wan't to use rewriteRule and cakephp routes for it I try lot of htaccess codes to resolve it but it didn't work somthing like: IfModule mod_rewrite.c RewriteEngine on RewriteCond %{REQUEST_URI} !^/piwik/ RewriteRule^piwik -[L] RewriteRule^$ app/webroot/[L] RewriteRule(.*) app/webroot/$1 [L] /IfModule and how can resolve this problem? thanks in advance -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
php cms and rewriteRule and cakephp routes
hi I have this folders in the host root: app lib plugins vendors piwik piwik is a php cms (just php no framework) but this address (mySite.com/piwik) don't go to /piwik folder and wan't to use rewriteRule and cakephp routes for it I try lot of htaccess codes to resolve it but it didn't work somthing like: IfModule mod_rewrite.c RewriteEngine on RewriteCond %{REQUEST_URI} !^/piwik/ RewriteRule^piwik -[L] RewriteRule^$ app/webroot/[L] RewriteRule(.*) app/webroot/$1 [L] /IfModule and how can resolve this problem? thanks in advance -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
REST routes without mod_rewrite
Hi, my client's web server don't has mod_rewrite enable, so I installed cake without mod_rewrite, everything work fine but REST routing. I made some test at my developing server and with mod_rewrite enable a GET request to http://localhost/Morrallas/1 is mapped to MorrallasController's view method and 1 is passed as argument. But if I removed the mod_rewrite support, then http://localhost/index.php/Morrallas/1 I got this error: *Error: * The action *1* is not defined in controller *MorrallasController* * * Do I need to edit routes.php and add something extra? Thanks in advance! -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- You received this message because you are subscribed to the Google Groups CakePHP group. To unsubscribe from this group and stop receiving emails from it, send an email to cake-php+unsubscr...@googlegroups.com. To post to this group, send email to cake-php@googlegroups.com. Visit this group at http://groups.google.com/group/cake-php?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Routes are confusing me
I'm working on the routes of my CakePHP site. The 'easy' ones I have already set like: Router::connect('/contact', array('controller' = 'contacts', 'action' = 'index')); These are working. But now I am confused as to how to continue with the more complex routing. For example, my url now is /findproducts/compare/1, where he goes to the controller findproducts and the action compare and 1 is the category_id. I have converted this with my routes to /vinden/vergelijk/1 (dutch translations). How do I get the 1 to swap with the category name? So that you don't get /vinden/vergelijken/1 but /vinden/vergelijken/food for example. Do I have to change all my html links for that? So that my controller doens't have the action public function compare($id = null) but public function compare($categoryname = null)? I hope not, because that would be a lot of work.. Another question, in some controllers I work with $this-params, if I change my routing, will this effect my passed params? Because sometimes I need these params, but I rather not have my visitors see them. I don't know if that is possible. I hope you understand what I want to do. I have read a lot about it (on the CakePHP website, this group, etc.) but I'm a little bit confused about how to do it. That's why I came here :) -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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.
Re: Routes are confusing me
On Tue, Nov 27, 2012 at 10:16 AM, iFemke femkevgem...@gmail.com wrote: I'm working on the routes of my CakePHP site. The 'easy' ones I have already set like: Router::connect('/contact', array('controller' = 'contacts', 'action' = 'index')); These are working. But now I am confused as to how to continue with the more complex routing. For example, my url now is /findproducts/compare/1, where he goes to the controller findproducts and the action compare and 1 is the category_id. I have converted this with my routes to /vinden/vergelijk/1 (dutch translations). How do I get the 1 to swap with the category name? So that you don't get /vinden/vergelijken/1 but /vinden/vergelijken/food for example. Do I have to change all my html links for that? So that my controller doens't have the action public function compare($id = null) but public function compare($categoryname = null)? I hope not, because that would be a lot of work.. To use the Category name in the route you should take a look at SluggableBehavior. What this does is create a new field based on the name that is usable in a URL. eg. translates spaces to hyphens, accented chars to ASCII, lowercase everything, etc. This occurs when the record is saved. For existing records you can either create the slugs yourself or edit each Category to re-save the record. For a Category model I'm working on now, I'm using both Sluggable and Sortable: public $actsAs = array( 'Sluggable' = array( 'translation' = 'utf-8', 'separator' = '-', 'label' = 'name', 'length' = 64, 'overwrite' = true ), 'Sortable' = array( 'orderField' = 'sort_order' ) ); To use the slug in a route is fairly simple, but you need to keep in mind what other potential routes may arise, so positioning in routes.php can be important. Router::connect( '/findproducts/compare/:slug', array( 'admin' = 1, 'controller' = 'findproducts', 'action' = 'compare' ), array( 'slug' = '[-0-9a-z]+', 'pass' = array('slug') ) ); Your method will then be: public function compare($slug = null) {} The you can pass the slug to your model methods and use a condition $this-alias.slug = $slug I prefer to use the id for admin methods, though: Router::connect( '/admin/categories/edit/:id', array( 'admin' = 1, 'controller' = 'categories', 'action' = 'edit' ), array( 'id' = '[0-9]+', 'pass' = array('id') ) ); To create links is simple. Always fetch the slug when doing a find(). Then you can pass it to Html::link() like this: foreach ($data as $d) { echo $this-Html-link( $d['Category']['name'], array( 'controller' = 'findproducts', 'action' = 'compare', 'slug' = $d['Category']['slug'] ), array( 'title' = __('compare: ') . $d['Category']['name'], 'escape' = false ) ); } -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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.
Routes with optional parameters
How do I set up a route that sometimes has a parameter and sometimes doesn't? For example, I have the following two routes but I'm sure they could be combined into one? Router::connect( '/open-account/:id', array( 'controller' = 'users', 'action' = 'add' ), array( 'pass' = array('id'), 'id' = '[a-z]+' ) ); Router::connect( '/open-account', array( 'controller' = 'users', 'action' = 'add' ) ); -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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.
Re: Routes with optional parameters
I think changing the regexp from + to ? in the first route would do it. Router::connect( '/open-account/:id', array( 'controller' = 'users', 'action' = 'add' ), array( 'pass' = array('id'), 'id' = '[a-z]?' ) ); On Wed, Nov 7, 2012 at 11:00 AM, Jeremy Burns jeremybu...@classoutfit.com wrote: How do I set up a route that sometimes has a parameter and sometimes doesn't? For example, I have the following two routes but I'm sure they could be combined into one? Router::connect( '/open-account/:id', array( 'controller' = 'users', 'action' = 'add' ), array( 'pass' = array('id'), 'id' = '[a-z]+' ) ); Router::connect( '/open-account', array( 'controller' = 'users', 'action' = 'add' ) ); -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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.
Problem with Routes. CakePHP repeating parameter
Hi, I'm having a problem and don't know where is the problem, maybe someone can help me out. I have created the following routes: foreach($cats as $cat) { $regra .= $cat[Categoria][url_rapida].|; } $regra = (.substr($regra, 0,-1).); // this return the structure (category-name|category-other-name|products|etc) //this route works fine Router::connect( '/:categoria_slug', array( 'controller' = 'categorias', 'action' = 'view' ), array( 'categoria_slug' = $regra ) ); //this route works fine Router::connect( '/:categoria_slug/page::page', array( 'controller' = 'categorias', 'action' = 'view' ), array( 'categoria_slug' = $regra, 'page' = '[0-9]+' ) ); Router::connect( '/:categoria_pai/:subcategoria', array( 'controller' = 'categorias', 'action' = 'view' ), array( 'categoria_pai' = $regra, 'subcategoria' = '[\w-_]+' ) ); Router::connect( '/:categoria_pai/:subcategoria/page::page', array( 'controller' = 'categorias', 'action' = 'view' ), array( 'categoria_pai' = $regra, 'subcategoria' = '[\w-_]+', 'page' = '[0-9]+' ) ); The problem is on the last two Routes. When I access the following: http://localhost/mywebsite/category-name/subcategory It should return to my controller this two parameters: $this-params[categoria_pai] = category-name $this-params[subcategoria] = subcategory BUT, it is repeating the first value on the two parameters: $this-params[categoria_pai] = category-name $this-params[subcategoria] = category-name Any ideas?? Thanks in advance. Kico -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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.
Re: Problem with Routes. CakePHP repeating parameter
Problem solved! I just took the () off the rule. this $regra = (.substr($regra, 0,-1).); become this $regra = substr($regra, 0,-1); On Sat, Oct 6, 2012 at 12:04 PM, Kico Zaninetti kicozanine...@gmail.comwrote: Hi, I'm having a problem and don't know where is the problem, maybe someone can help me out. I have created the following routes: foreach($cats as $cat) { $regra .= $cat[Categoria][url_rapida].|; } $regra = (.substr($regra, 0,-1).); // this return the structure (category-name|category-other-name|products|etc) //this route works fine Router::connect( '/:categoria_slug', array( 'controller' = 'categorias', 'action' = 'view' ), array( 'categoria_slug' = $regra ) ); //this route works fine Router::connect( '/:categoria_slug/page::page', array( 'controller' = 'categorias', 'action' = 'view' ), array( 'categoria_slug' = $regra, 'page' = '[0-9]+' ) ); Router::connect( '/:categoria_pai/:subcategoria', array( 'controller' = 'categorias', 'action' = 'view' ), array( 'categoria_pai' = $regra, 'subcategoria' = '[\w-_]+' ) ); Router::connect( '/:categoria_pai/:subcategoria/page::page', array( 'controller' = 'categorias', 'action' = 'view' ), array( 'categoria_pai' = $regra, 'subcategoria' = '[\w-_]+', 'page' = '[0-9]+' ) ); The problem is on the last two Routes. When I access the following: http://localhost/mywebsite/category-name/subcategory It should return to my controller this two parameters: $this-params[categoria_pai] = category-name $this-params[subcategoria] = subcategory BUT, it is repeating the first value on the two parameters: $this-params[categoria_pai] = category-name $this-params[subcategoria] = category-name Any ideas?? Thanks in advance. Kico -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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. -- Like Us on FaceBook https://www.facebook.com/CakePHP Find us on Twitter http://twitter.com/CakePHP --- 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.
Re: Documentation on modifying default REST routes
On Thu, Aug 9, 2012 at 4:38 PM, Lightee lightai...@gmail.com wrote: What if the wanted data to be returned is based on data fields other than the id? It is restricting to get data based on id only. Is there some way to get data based on other fields of the table? Did you look here: http://book.cakephp.org/2.0/en/development/rest.html#custom-rest-routing Mike. -- 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: Documentation on modifying default REST routes
Thanks for your patient replies. Yes, I did read it even a few times but cannot be sure if I understand correctly. The problem is there is no sample code to test one's understanding. ?phpRouter::connect( /:controller/:id, array(action = edit, [method] = PUT), array(id = [0-9]+)); I am guessing that what it means is that the action edit uses HTTP PUT and the parameter passed in is the id field. id field is a digit. What if I want to pass in 2 or more parameters which are not primary keys? May I know if this can be done in CakePHP? Thank you very much. On Friday, August 10, 2012 4:43:35 PM UTC+8, Mike Griffin wrote: On Thu, Aug 9, 2012 at 4:38 PM, Lightee light...@gmail.com javascript: wrote: What if the wanted data to be returned is based on data fields other than the id? It is restricting to get data based on id only. Is there some way to get data based on other fields of the table? Did you look here: http://book.cakephp.org/2.0/en/development/rest.html#custom-rest-routing Mike. On Friday, August 10, 2012 4:43:35 PM UTC+8, Mike Griffin wrote: On Thu, Aug 9, 2012 at 4:38 PM, Lightee light...@gmail.com javascript: wrote: What if the wanted data to be returned is based on data fields other than the id? It is restricting to get data based on id only. Is there some way to get data based on other fields of the table? Did you look here: http://book.cakephp.org/2.0/en/development/rest.html#custom-rest-routing Mike. -- 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: Documentation on modifying default REST routes
On Fri, Aug 10, 2012 at 9:58 AM, Lightee lightai...@gmail.com wrote: Thanks for your patient replies. Yes, I did read it even a few times but cannot be sure if I understand correctly. The problem is there is no sample code to test one's understanding. ?php Router::connect( /:controller/:id, array(action = edit, [method] = PUT), array(id = [0-9]+) ); I am guessing that what it means is that the action edit uses HTTP PUT and the parameter passed in is the id field. id field is a digit. What if I want to pass in 2 or more parameters which are not primary keys? May I know if this can be done in CakePHP? What have you tried? You can get more documentation in the API http://api.cakephp.org/class/router#method-Routerconnect Mike. -- 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.
Documentation on modifying default REST routes
Dear Cakephp gurus, I am trying to build web services using CakePHP. The default REST routes are not suitable for me as add, edit, update, delete are already taken up for other purposes. I need to modify the default rates. From http://book.cakephp.org/2.0/en/development/rest.html, ?phpRouter::resourceMap(array( array('action' = 'index', 'method' = 'GET', 'id' = false), array('action' = 'view', 'method' = 'GET', 'id' = true), array('action' = 'add', 'method' = 'POST', 'id' = false), array('action' = 'edit', 'method' = 'PUT', 'id' = true), array('action' = 'delete', 'method' = 'DELETE', 'id' = true), array('action' = 'update', 'method' = 'POST', 'id' = true))); What does 'id'=false or true means? I cannot find sufficient documentation in the API documentation. I have tried to search everywhere on sample code for CakePHP web services. But all I found are 2 links on related documentation http://book.cakephp.org/2.0/en/development/rest.html http://book.cakephp.org/2.0/en/views/json-and-xml-views.html To newbies like me, it is not very helpful although it may be enough for the experts. Can someone point me to more links? Thank you very much. -- 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: Documentation on modifying default REST routes
On Thu, Aug 9, 2012 at 1:41 PM, Lightee lightai...@gmail.com wrote: Dear Cakephp gurus, ?php Router::resourceMap(array( array('action' = 'index', 'method' = 'GET', 'id' = false), array('action' = 'view', 'method' = 'GET', 'id' = true), array('action' = 'add', 'method' = 'POST', 'id' = false), array('action' = 'edit', 'method' = 'PUT', 'id' = true), array('action' = 'delete', 'method' = 'DELETE', 'id' = true), array('action' = 'update', 'method' = 'POST', 'id' = true) )); What does 'id'=false or true means? I cannot find sufficient documentation in the API documentation. The id bit probably means that an id is being sent to the method. A view method needs an id to return the single thing that is being viewed whereas the index doesn't need one as it returns a list of all things. The same for each of the other methods. Hope this helps. Mike. -- 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: Documentation on modifying default REST routes
What if the wanted data to be returned is based on data fields other than the id? It is restricting to get data based on id only. Is there some way to get data based on other fields of the table? The id bit probably means that an id is being sent to the method. A view method needs an id to return the single thing that is being viewed whereas the index doesn't need one as it returns a list of all things. The same for each of the other methods. Hope this helps. Mike. -- 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: Routes with slugs, pagination problem
Router::connect( '/:slug', array( 'controller' = 'categories', 'action' = 'view' ), array( 'slug' = '[-a-z0-9]+', 'pass' = array('slug') ) ); Router::connect( '/:slug/:page', array( 'controller' = 'categories', 'action' = 'view' ), array( 'slug' = '[-a-z0-9]+', 'page' = '[0-9]+', 'pass' = array('slug') ) ); And I had to put the following in AppController::beforeFilter when I upgraded to 2.x: if (isset($this-request-params['page'])) { $this-request-params['named']['page'] = $this-request-params['page']; } On Thu, Jun 28, 2012 at 6:10 PM, Ovidiu Marinoiu ovidiu.marin...@gmail.com wrote: Hello, I have created a route which looks like this Router::connect('/:slug', array('controller' = 'categories', 'action' = 'view'), array('pass' = array('slug'))); Until here, everything works okey, visiting the link http://example.com/animals-and-pets, works perfect. On this page I have a pagination and this gives me e big problem, the links for the pages, are generating wrong, like this: http://example.com/categories/view/animals-and-pets/page:2. The result that I want to obtain is http://example.com/animals-and-pets/2. Thanks for your help in advance! -- 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
Routes vs Type checking for Action Parameters, best practice?
Lets say I have a controller Books with an action view() defined as follows: class BooksController extends AppController { public function view($id) { // something } } Let's assume that $id is supposed to be of a numeric type. I see two options; 1) Setup the route so that it only connects for instance books/view/{integer} to Books-view($id) 2) Have general routing like the defaults in CakePHP and include code in view() to make sure that $id is set and is numeric. Which is better practice? In my view I think the former is cleaner and less magicky. This is something I enjoyed working with the Play Framwork, that you explicitly had to connect a route to each action. What is your opinion? -- 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: Routes vs Type checking for Action Parameters, best practice?
What happens if you pass an $id that is an integer but that $id doesn't exist in the books table? Jeremy Burns Class Outfit http://www.classoutfit.com On 28 Jun 2012, at 11:26:40, Poyan Nabati wrote: Lets say I have a controller Books with an action view() defined as follows: class BooksController extends AppController { public function view($id) { // something } } Let's assume that $id is supposed to be of a numeric type. I see two options; 1) Setup the route so that it only connects for instance books/view/{integer} to Books-view($id) 2) Have general routing like the defaults in CakePHP and include code in view() to make sure that $id is set and is numeric. Which is better practice? In my view I think the former is cleaner and less magicky. This is something I enjoyed working with the Play Framwork, that you explicitly had to connect a route to each action. What is your opinion? -- 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: Routes vs Type checking for Action Parameters, best practice?
That's another type of error though. It's something have to handle in your application but I don't see the relation to my OP. -- 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: Routes vs Type checking for Action Parameters, best practice?
I disagree. I think you're not using routes in their purest form (to route stuff in the right way - rather than error trapping) and even if it passes you still need to check the validity in the controller and redirect if necessary. Why do that in two places? And what happens in the router if a non-integer is passed? Jeremy Burns Class Outfit http://www.classoutfit.com On 28 Jun 2012, at 12:58:36, Poyan Nabati wrote: That's another type of error though. It's something have to handle in your application but I don't see the relation to my OP. -- 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: Routes vs Type checking for Action Parameters, best practice?
Apart from what Jeremy said you should also remember that routes are expensive. Use them wisely Tarique On Thu, Jun 28, 2012 at 5:36 PM, Jeremy Burns | Class Outfit jeremybu...@classoutfit.com wrote: I disagree. I think you're not using routes in their purest form (to route snip -- = PHP for E-Biz: http://sanisoft.com = -- 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: Routes vs Type checking for Action Parameters, best practice?
I think you're not using routes in their purest form (to route stuff in the right way - rather than error trapping. Thing is, if you haven't supplied an integer, then there's really no matching action for the URL you've requested. I think that's completely in line with the purpose of routes. That is, if you supply a non-integer, then you haven't really matched any existing action, so you're redirected to an error or a default page. Since PHP doesn't really have strict typing, maybe I could settle for if you haven't passed the right number of parameters, there's no matching action. Why do that in two places? I think it could result in cleaner code since you can be sure of the type and amount of input you receive in each action. Don't you agree? -- 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: Routes vs Type checking for Action Parameters, best practice?
Why do that in two places? Because it does not do the same thing. You always have to validate the $id in the controller, since as already said, the $id can be a perfect integer, but does not exist in the database. I assume your example in the router file will be like that : Router::connect('/books/view/:id', array('controller'='books', 'action'='view'), array('pass' = array('id'), 'id' = '[0-9]+?')); There's no benefits of enforcing a numeric validation on the ID in this case. But if you have routes like that : Router::connect('/books/:id', array('controller'='books', 'action'='view'), array('pass' = array('id'), 'id' = '[0-9]+?')); Router::connect('/books/:action', array('controller'='books', 'action'='add')); making sure the id is numeric is necessary, else the second route will never be read, and all your url like books/add, or whatever will be redirect to the view action. Type validation in the routes are to redirect the flow to the right action in the right controller, for the routes that can be ambiguous. -- 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 with slugs, pagination problem
Hello, I have created a route which looks like this Router::connect('/:slug', array('controller' = 'categories', 'action' = 'view'), array('pass' = array('slug'))); Until here, everything works okey, visiting the link http://example.com/animals-and-pets, works perfect. On this page I have a pagination and this gives me e big problem, the links for the pages, are generating wrong, like this: http://example.com/categories/view/animals-and-pets/page:2. The result that I want to obtain is http://example.com/animals-and-pets/2. Thanks for your help in advance! -- 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 Pagination and Routes
Hi guys, I have this route: Router::connect('/comparacao/:id/:slug', array('controller' = 'products', 'action' = 'comparison'), array('pass' = array('id', 'slug')) ); When I access below url, it work successfully http://myproject/comparacao/6315/Lata-DVD-O-Fantastico-Jaspion-Vol-1-5-DVDs I am performing a query using PaginatorComponent (through 'model_id', in this case 6315), when I click in a link generated by ?php echo $this-Paginator-numbers(); ? I go for this url: http://myproject/products/comparison/6315/Lata-DVD-O-Fantastico-Jaspion-Vol-1-5-DVDs/page:2 and I get this error: Error: The requested address '/products/comparison/6315/Lata-DVD-O- Fantastico-Jaspion-Vol-1-5-DVDs/page:2' was not found on this server. I have to active named params for my route (like http://book.cakephp.org/2.0/en/development/routing.html#controlling-named-parameters)? I have tried activate named params through: Router::connectNamed(false, array('default' = true));, Router::connectNamed(array('page'), array('default' = false, 'greedy' = false)); and others, but I have failed. What I really would like to use route from paginator as I used one time in Cake 1.3 (http://stackoverflow.com/questions/5033633/cakephp- custom-route-pagination), just adding /2 in the end of route (2 is number of page), but I have tried it in Cake 2 and I think that just using Custom Routing Class. Someone can help me? Thank you. -- 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 Pagination and Routes
See here https://groups.google.com/d/topic/cake-php/DS1rF9RiKBk/discussion -- 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 Pagination and Routes
Thank you.It will solve my problem. But, just for knowledge, what I need to do for pagination with name params works (see below)? **http://myproject/comparacao/6315/Lata-DVD-O-Fantastico-Jaspion-Vol-1-5-DVDs *http://myproject/comparacao/6315/Lata-DVD-O-Fantastico-Jaspion-Vol-1-5-DVDshttp://myproject/comparacao/6315/Lata-DVD-O-Fantastico-Jaspion-Vol-1-5-DVDs/page:2http://myproject/comparacao/6315/Lata-DVD-O-Fantastico-Jaspion-Vol-1-5-DVDs/page:2 *http://myproject/comparacao/6315/Lata-DVD-O-Fantastico-Jaspion-Vol-1-5-DVDs/page:2 /page:2 Thank you. Em quarta-feira, 30 de maio de 2012 15h34min38s UTC-3, Salines escreveu: See here https://groups.google.com/d/topic/cake-php/DS1rF9RiKBk/discussion -- 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: Little help with routes and links
Thanks guys for all your tips... I couldn't wrap my head around http://book.cakephp.org/2.0/en/development/routing.html but now it's all clear... :) I ended up using lowpass solution and it all works great so thanks again... -- 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: Little help with routes and links
First off, I suggest you add slug columns to both your tables. You might eventually have color names like rosy red which should be sluggified. And I wouldn't count on the product names always being a single word. So, this is one way to do what you want: Router::connect( '/items/:color/:slug', array( 'controller' = 'products', 'action' = 'view' ), array( 'color' = implode('|', Cache::read('product_colors')), 'slug' = '[a-z0-9]+', 'pass' = array('slug', 'color') ) ); bootstrap.php: $colors = Cache::read('product_colors'); if (empty($colors)) { App::import('Model', 'Color'); $Color = new Color(); $colors = $Color-find( 'list', array( 'fields' = array('Color.slug') ) ); Cache::write('product_colors', $colors); } controller: public function view($slug = null, $color = null) { ... } That should work fine but if you're using Cake 2.x you'd probably be better off creating a route class by extending CakeRoute. On Tue, May 8, 2012 at 8:26 AM, Confused Dev confused.de...@gmail.com wrote: Hello. I need help with defining some unusual routes. Here are my 2 tables Colors and Products: mysql select * from colors; ++--+ | id | name | ++--+ | 1 | blue | ++--+ mysql select * from products; ++--+--+ | id | name | color_id | ++--+--+ | 1 | bowl | 1 | ++--+--+ Normally Cake will produce links like this: http://example.com/products/view/1 I'd like to have links like this: http://example.com/items/blue/bowl/1 I don't even know where to begin to make it produce automatic links like that. Any help would be greatly appreciated. -- 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
Little help with routes and links
Hello. I need help with defining some unusual routes. Here are my 2 tables Colors and Products: mysql select * from colors; ++--+ | id | name | ++--+ | 1 | blue | ++--+ mysql select * from products; ++--+--+ | id | name | color_id | ++--+--+ | 1 | bowl |1 | ++--+--+ Normally Cake will produce links like this: http://example.com/products/view/1 I'd like to have links like this: http://example.com/items/blue/bowl/1 I don't even know where to begin to make it produce automatic links like that. Any help would be greatly appreciated. -- 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: Little help with routes and links
I'm not an expert on routes, either. But I would start here to find out.Routing Cookbook v2http://book.cakephp.org/2.0/en/development/routing.html Sincerely, Michael Stelly mobile: +1.918.978.2000 skype: mjstelly LinkedIn http://www.linkedin.com/in/mstelly On Tue, May 8, 2012 at 7:26 AM, Confused Dev confused.de...@gmail.comwrote: Hello. I need help with defining some unusual routes. Here are my 2 tables Colors and Products: mysql select * from colors; ++--+ | id | name | ++--+ | 1 | blue | ++--+ mysql select * from products; ++--+--+ | id | name | color_id | ++--+--+ | 1 | bowl |1 | ++--+--+ Normally Cake will produce links like this: http://example.com/products/view/1 I'd like to have links like this: http://example.com/items/blue/bowl/1 I don't even know where to begin to make it produce automatic links like that. Any help would be greatly appreciated. -- 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: Little help with routes and links
On Tue, May 8, 2012 at 1:26 PM, Confused Dev confused.de...@gmail.com wrote: Hello. I'd like to have links like this: http://example.com/items/blue/bowl/1 I don't even know where to begin to make it produce automatic links like that. Any help would be greatly appreciated. You could try something like this, it probably won't work as written, but it might give you a starting point. Router::connect( '/items/:colour/:item/:number', array('controller' = 'items', 'action' = 'index', 'number' = null), array( 'colour' = '\w+', 'item' = '\w+', 'number' = '\d+' ) ); Also, have a look at http://book.cakephp.org/2.0/en/development/routing.html#passing-parameters-to-action 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: Little help with routes and links
Can you throw some background on what you are trying to achieve (why these links?)? Jeremy Burns Class Outfit http://www.classoutfit.com On 8 May 2012, at 14:29:16, Mike Griffin wrote: On Tue, May 8, 2012 at 1:26 PM, Confused Dev confused.de...@gmail.com wrote: Hello. I'd like to have links like this: http://example.com/items/blue/bowl/1 I don't even know where to begin to make it produce automatic links like that. Any help would be greatly appreciated. You could try something like this, it probably won't work as written, but it might give you a starting point. Router::connect( '/items/:colour/:item/:number', array('controller' = 'items', 'action' = 'index', 'number' = null), array( 'colour' = '\w+', 'item' = '\w+', 'number' = '\d+' ) ); Also, have a look at http://book.cakephp.org/2.0/en/development/routing.html#passing-parameters-to-action 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 -- 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 to catch complete querystring
Hi, depening of used search criterias it can happen that I want to call this url: '/search/cat:10/city:6/sleeps:4/price:3/' But it can be also just '/search/cat:10/city:6/price:3/' or '/search/city:6/sleeps:4/price:3/' or any other combination... That means, I need to have a route what transfers all to controller=objects and action=search and then pass the querystring to it. Can someone help finding out how I can do it? Having in mind that I never really now what will be passed, the only thing I know is the /search/ part. Thanks in advance!! -- 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: Routes to catch complete querystring
I just found this: Router::connect('/search/*', array('controller' = 'objekts', 'action' = 'search', Router::queryString($this-params['url']))); this returns me this error: *Notice* (8) javascript:void(0);: Undefined property: Dispatcher::$params [*APP\Config\routes.php*, line *48*] But it will create me this array. array( 'plugin' = null, 'controller' = 'objects', 'action' = 'search', 'named' = array( 'cat' = '1', 'city' = '57', 'sleeps' = '2', 'price' = '1' ), 'pass' = array( (int) 0 = null, (int) 1 = 'txt1', (int) 2 = 'txt2', (int) 3 = 'sl' ) ) I just need to understand why the error appears, then I am done :-) -- 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
cache helper isnt aware of routes?
I have implemented view caching on my app and it works fine it caches view method from posts controller (posts/view) However, after i added Router::connect('/', array('controller' = 'posts', 'action' = 'view',1)); it wont cache the main page. Seems it checks only url as a string and is not aware of routes. Can anyone help me solve this issue or give me some tips? 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
How to make the routes working with CakePHP in a subdirectory
I have a little Webpage set up with a little CakePHP Webapp in it. The CakePHP stuff is in a subdirectory and so I got my .htaccess like this: IfModule mod_rewrite.c RewriteEngine on RewriteRule ^test/subdirectory$ subdirectory/app/webroot RewriteRule ^test/subdirectory/(.*)$ subdirectory/app/webroot/$1 /IfModule Now navigating to domain.com/subdirectory works, but for my route to login I only get a 404 =( Router::connect( '/login', array('controller' = 'users', 'action' = 'login')); Could you please help me? //edit: I just tried around a little bit, my other routes like domain.com/controller/action/id don't work either. -- 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 make the routes working with CakePHP in a subdirectory
Got it, i just forgot to add the RewriteBase to one of the three .htaccess files. Sorry guys :) Am Donnerstag, 1. März 2012 21:09:41 UTC+1 schrieb Optik Fluffel: I have a little Webpage set up with a little CakePHP Webapp in it. The CakePHP stuff is in a subdirectory and so I got my .htaccess like this: IfModule mod_rewrite.c RewriteEngine on RewriteRule ^test/subdirectory$ subdirectory/app/webroot RewriteRule ^test/subdirectory/(.*)$ subdirectory/app/webroot/$1 /IfModule Now navigating to domain.com/subdirectory works, but for my route to login I only get a 404 =( Router::connect( '/login', array('controller' = 'users', 'action' = 'login')); Could you please help me? //edit: I just tried around a little bit, my other routes like domain.com/controller/action/id don't work either. -- 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
Cutom Routes
When a Controller of Plugin isn't found. I want it to end at a specific controller that examines the ulr, and checks if there'r a page related to it in my cms. So, after the default cakephp routing I don't want the missing controller error but I want to route to a controller. How can I Accomplish this? -- 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: Cutom Routes
Waterschaats, Have a look at the Error Controller: http://book.cakephp.org/1.3/view/1188/Error-Handling For more information on the types of pre-existing errors - including the missingController error, have a look at the API: http://api.cakephp.org/class/error-handler#method-ErrorHandlermissingController And remember: nothing says I know CakePHP like dipping your toes in the core-code waters! -- 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: Cutom Routes
Thanks this is usefull. Although I was thinking of accomplishing this with Routes. It feels a bit wrong to handle this with an error function. And is this performance wise the best option? -- 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: Cutom Routes
by the way. I'm using cakephp 2.0 (The error handling implementation has dramatically changed in 2.0) -- 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: Cutom Routes
Considering that this is the way CakePHP handles errors, yes, it is certainly the most efficient option on its face. Others may dispute that. I wouldn't really consider using Routes, because the routes are determined *before* the existence of any Controllers or Actions is confirmed. I do, however, have a catchall clause in my routes.php file that says: Router::connect('/*', array('controller' = 'pages', 'action' = 'display')); This is basically in a situation where every other route is specified by the routes.php file. The reason for this is simply because so much of what my company wants to do in terms of routing has little to nothing to do with the way CakePHP wants to do things. If this helps you, go for it. -- 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: Cutom Routes
Ah, well, then I'm out of my element, Donnie. (Sorry for the Big Lebowski reference). -- 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: Cutom Routes
Thanks, In case of using: Router::connect('/*', array('controller' = 'pages', 'action' = 'display')); I have to specifie all the controller I use. I don't want that. -- 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 creates wrong routes for reverse proxy
Hello, My CakePHP application is accesible through a mod_alias rule in the apache config. Due to this fact its accesible on the root of the apache folder. For example: apps.example.com/app1/ The Application works without problems on this URL but it don't work for a reverse proxy. The reverse proxy points on the apps.example.com/ app1/webroot/ folder. The index page is working but all CSS/JS includes and all links use the app1-prefix. For example the Link to the controller-view should be http://web.example2.co.uk/controller/view atm cakephp creates links like http://web.example2.co.uk/app1/controller/view which don't work. I tried to fix it with mod_rewrite but I can't remove the directory name (app1) from the created links. How can I change/extend CakePHP to fix this? Thanks, Steffen -- 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
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: Routes Problem
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
uso de routes para modficar urls
Hola gente, he visto en el book de cake el uso de routes para modficar la url con cosas simple, pero no he visto nada como modificar por ejemplo algo como esto: si mu ruta es /user/view/4 (Estaría viendo el user 4), lo tendría que dejar algo como: /user/view_user/nombre_de_usuario_31_may_1985 (donde nombre de usuario es el username de la db de dicho usuario y 31 may 1985 es la fecha de nacimiento del mismo por ejemplo... necesito hacer cosas similares a esas y sin que la aplicación haga un redirect. Las preguntas son 1- Se puede hacer esto con el routes.conf ? gracias Christian -- 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
Login function and routes
Hi, I have a project that required 3 group which are admin, agents and users. These group will using only one login page. In login page there are username,password and 2 radio button which are members(admin and agents) and user. After login, admin could view fully CMS and dashboard, agents could view only certain part of CMS and dashboard while users only could view the dashboard. So, what is the best way to implement it? 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: Login function and routes
You don't need the radio buttons at all. http://cakephp.1045679.n5.nabble.com/CakeDC-Users-Plugin-redirect-based-on-role-td3410081.html(see sam bernards comments) http://www.packtpub.com/article/cakephp-authentication-setup-application(roles are mentioned later on) - S On 9 August 2011 17:29, nOLL hasnolm...@gmail.com wrote: Hi, I have a project that required 3 group which are admin, agents and users. These group will using only one login page. In login page there are username,password and 2 radio button which are members(admin and agents) and user. After login, admin could view fully CMS and dashboard, agents could view only certain part of CMS and dashboard while users only could view the dashboard. So, what is the best way to implement it? 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: Login function and routes
Thanks Sam. On Wed, Aug 10, 2011 at 12:53 AM, Sam Sherlock sam.sherl...@gmail.comwrote: You don't need the radio buttons at all. http://cakephp.1045679.n5.nabble.com/CakeDC-Users-Plugin-redirect-based-on-role-td3410081.html(see sam bernards comments) http://www.packtpub.com/article/cakephp-authentication-setup-application(roles are mentioned later on) - S On 9 August 2011 17:29, nOLL hasnolm...@gmail.com wrote: Hi, I have a project that required 3 group which are admin, agents and users. These group will using only one login page. In login page there are username,password and 2 radio button which are members(admin and agents) and user. After login, admin could view fully CMS and dashboard, agents could view only certain part of CMS and dashboard while users only could view the dashboard. So, what is the best way to implement it? 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 -- 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 in config routes
hi I'm have noob question I try to create link to login page this $html-link('login',array('url'=array('controller'='users','action'='login'))) but output in 127.0.0.1/cakephp/user_articles/users/login how to config it thank taqman -- 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 in config routes
its $html-link('linkname', array('controller' = 'yourcontroller', 'action' = 'youraction')); -- Lep pozdrav, Tilen Majerle http://majerle.eu 2011/7/30 taqman filler taqman...@gmail.com hi I'm have noob question I try to create link to login page this $html-link('login',array('url'=array('controller'='users','action'='login'))) but output in 127.0.0.1/cakephp/user_articles/users/login how to config it thank taqman -- 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
Routes, Rewrites such
Hi all, I'm trying to get my head round the best way to use the same CakePHP App code for multiple clients, the best way I can think of is to have a client identifier at the beginning of the path for the app, use rewrites/custom routes to facilitate this. So far I have added the following rule to the .htaccess file for the app, which extracts the client identifier out to a query string element... RewriteRule (test)(/.*) $2?client=$1 [QSA,N] ... but now I need to work out how to make sure the app adds this identifier back on to the beginning of any URL generated by Cake. Any clues on how I might do this? Not too hot with playing with routes yet. Thanks, T -- 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: Routes, Rewrites such
I managed to get this working in the end. I got rid of the Rewrite Rule added the following rules to get this working... Router::connect('/:cid', array( 'controller' = 'events', 'action' = 'index' ), array( 'cid' = 'alika-bo', 'persist' = array('cid'), ) ); Router::connect('/:cid/:controller', array( 'action' = 'index' ), array( 'cid' = 'alika-bo', 'persist' = array('cid'), ) ); Router::connect('/:cid/:controller/:action/*', array(), array( 'cid' = 'alika-bo', 'persist' = array('cid'), ) ); And it also took me a while before I realised that I also needed to add... Router::connectNamed(array('cid', 'event_id')); ... to get url generation working OK when the event_id parameter was included in the link. -- 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
custom routes slow down my application
custom routes slow down my application I have loop in the routes in which I'm connecting and processing more than 100 custom routes but now my app is experiencing hard time when is loading Render Controller Action 6600 ms Any suggestion how to resolve this -- 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: custom routes slow down my application
It's a design issue with your application. There's no need to be instantiating 100's of routes for a single request. What you should do, is use a custom route class to bind the request to a controller/action. http://mark-story.com/posts/view/using-custom-route-classes-in-cakephp On Jul 2, 2011, at 9:03 AM, me...@yahoo.com wrote: custom routes slow down my application I have loop in the routes in which I'm connecting and processing more than 100 custom routes but now my app is experiencing hard time when is loading Render Controller Action 6600 ms Any suggestion how to resolve this -- 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
Ask about regex in routes rule .
In routers.php , i wrote this line. Router::connect('/pages/:id/:slug', array('controller' = 'pages', 'action' = 'view'), array('pass' = array('id', 'slug'), 'id' = '[0-9A-Za-z]{6}')); now i can access http://example.com/pages/7hf763/this_is_slug but how i can access function public() action : http://example.com/pages/public -- 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
Reverse lookup of routes
The custom route detailed in the CakePHP CookBook is working fine as long as it's used in one direction. Inside the routes.php file I'm using the following route: Router::connect('/:language/artists/:id', array('controller'='artists','action'='view'), array('pass' = array('id'), 'language' = '[a-z]{3}','id' = '[0-9]{1}')); , So I can accesss the View Action of the ArtistsController via http://xxx/artists/:id . But what about the reverse lookup. Shouldn't a call to $html- link('Artist 2', array( 'controller' = 'artists', 'action' = 'view', 2)) print out a link to http://xxx/artists/2 ? Instead it gives a link to http://xxx/artists/view/2. Is this expected behavior? -- 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: Reverse lookup of routes
The language ($this-param['langauge']) ]is already set and I didn't explicitly specify it because I don't want it to change will going through the page. On Apr 8, 5:50 am, Ryan Schmidt google-2...@ryandesign.com wrote: On Apr 7, 2011, at 12:42, ThunderTD wrote: I configured my route similar to one example in the CakePHP Book. I want to reach the ArtistsController's view action via the URL http://xxx/artists/id. Everything is working fine with the following Routes entry and this direction: Router::connect('/:language/artists/:id', array('controller'='artists','action'='view'), array('pass' = array('id'), 'language' = '[a-z]{3}','id' = '[0-9]{1}')); But what about the proper reverse lookup? If I use the HtmlHelper Function Link in the following way: $html-link('Artist 2', array( 'controller' = 'artists', 'action' = 'view', 2 )) , the link is resolved tohttp://xxx/artists/view/2instead of the desiredhttp://xxx/artists/2. Is this the desired behavior? It doesn't look like you specified the language in the $html-link (properly: $this-Html-link) command, and your route does seem to rely on the language being set. Did you mean to specify it there, or is it being included by some other means that you didn't show? -- 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: Reverse lookup of routes
Ok. Solved the problem! I had to explicitly name the id-element! Using the following code to create the link solved the problem: $html-link( 'Artist 2', array( 'controller' = 'artists', 'action' = 'view', 'id' = 2 ) ) On Apr 9, 9:31 am, ThunderTD alexfestb...@googlemail.com wrote: The language ($this-param['langauge']) ]is already set and I didn't explicitly specify it because I don't want it to change will going through the page. On Apr 8, 5:50 am, Ryan Schmidt google-2...@ryandesign.com wrote: On Apr 7, 2011, at 12:42, ThunderTD wrote: I configured my route similar to one example in the CakePHP Book. I want to reach the ArtistsController's view action via the URL http://xxx/artists/id. Everything is working fine with the following Routes entry and this direction: Router::connect('/:language/artists/:id', array('controller'='artists','action'='view'), array('pass' = array('id'), 'language' = '[a-z]{3}','id' = '[0-9]{1}')); But what about the proper reverse lookup? If I use the HtmlHelper Function Link in the following way: $html-link('Artist 2', array( 'controller' = 'artists', 'action' = 'view', 2 )) , the link is resolved tohttp://xxx/artists/view/2insteadof the desiredhttp://xxx/artists/2. Is this the desired behavior? It doesn't look like you specified the language in the $html-link (properly: $this-Html-link) command, and your route does seem to rely on the language being set. Did you mean to specify it there, or is it being included by some other means that you didn't show? -- 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: Reverse lookup of routes
On Sat, Apr 9, 2011 at 3:27 AM, ThunderTD alexfestb...@googlemail.com wrote: The custom route detailed in the CakePHP CookBook is working fine as long as it's used in one direction. Inside the routes.php file I'm using the following route: Router::connect('/:language/artists/:id', array('controller'='artists','action'='view'), array('pass' = array('id'), 'language' = '[a-z]{3}','id' = '[0-9]{1}')); , So I can accesss the View Action of the ArtistsController via http://xxx/artists/:id . But what about the reverse lookup. Shouldn't a call to $html- link('Artist 2', array( 'controller' = 'artists', 'action' = 'view', 2)) print out a link to http://xxx/artists/2 ? Instead it gives a link to http://xxx/artists/view/2. Is this expected behavior? Yes. You need to pass your params like this: $this-Html-link( 'Artist 2', array( 'controller' = 'artists', 'action' = 'view', 'language' = 'fre', 'id' = 2 ) ); Notice that you'd forgotten language. Also, your route doesn't pass language. Router::connect( '/:language/artists/:id', array( 'controller'='artists', 'action'='view'), array( 'pass' = array( 'language', 'id' ), 'language' = '[a-z]{3}', 'id' = '[0-9]+' ) ); I've also changed your regexp here for id. The way you had it, only ids between 0 9 would match. -- 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
Reverse lookup of routes
I configured my route similar to one example in the CakePHP Book. I want to reach the ArtistsController's view action via the URL http://xxx/artists/id. Everything is working fine with the following Routes entry and this direction: Router::connect('/:language/artists/:id', array('controller'='artists','action'='view'), array('pass' = array('id'), 'language' = '[a-z]{3}','id' = '[0-9]{1}')); But what about the proper reverse lookup? If I use the HtmlHelper Function Link in the following way: $html-link('Artist 2', array( 'controller' = 'artists', 'action' = 'view', 2 )) , the link is resolved to http://xxx/artists/view/2 instead of the desired http://xxx/artists/2 . Is this the desired behavior? Regards, Alex -- 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: Reverse lookup of routes
On Apr 7, 2011, at 12:42, ThunderTD wrote: I configured my route similar to one example in the CakePHP Book. I want to reach the ArtistsController's view action via the URL http://xxx/artists/id. Everything is working fine with the following Routes entry and this direction: Router::connect('/:language/artists/:id', array('controller'='artists','action'='view'), array('pass' = array('id'), 'language' = '[a-z]{3}','id' = '[0-9]{1}')); But what about the proper reverse lookup? If I use the HtmlHelper Function Link in the following way: $html-link('Artist 2', array( 'controller' = 'artists', 'action' = 'view', 2 )) , the link is resolved to http://xxx/artists/view/2 instead of the desired http://xxx/artists/2 . Is this the desired behavior? It doesn't look like you specified the language in the $html-link (properly: $this-Html-link) command, and your route does seem to rely on the language being set. Did you mean to specify it there, or is it being included by some other means that you didn't show? -- 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
CakeDC Users plugin - routes issue
Hi there there, I have integrated the CakeDC Users plugin fine and it all works out of the box, however I want to uses some neater routes for the login,register,dashboard actions but adding the following route: Router::connect('/login', array('plugin' = 'users','controller' = 'users', 'action' = 'login')); Causes the login to break and I just get a white screen? Has anyone got any suggestions? Has anyone successfully achieved this? TIA, d//t -- 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: CakeDC Users plugin - routes issue
On Thu, Feb 17, 2011 at 7:02 AM, designv...@gmail.com designv...@gmail.com wrote: Hi there there, I have integrated the CakeDC Users plugin fine and it all works out of the box, however I want to uses some neater routes for the login,register,dashboard actions but adding the following route: Router::connect('/login', array('plugin' = 'users','controller' = 'users', 'action' = 'login')); Causes the login to break and I just get a white screen? A blank screen generally means a fatal error somewhere. Have you looked at the server's log? Also, try setting debug to 2. -- 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: Help on Routes, should we use it ?
Thanks..wow, cricket your explanation is way advanced for me. But I got the concept...thanks everyone. regards, Maxim On Dec 29, 10:29 am, cricket zijn.digi...@gmail.com wrote: On Tue, Dec 28, 2010 at 10:14 AM, John Maxim goog...@gmail.com wrote: Refer to link below: http://book.cakephp.org/view/1541/Routes I don't understand. What does it accomplish ?? Do we normally change the route as shown from the link above ? Cake's routes default to: /controller/action/param So, if you had a BookController, to view a specific Book, you'd have something like: /books/view/42 ... where 42 is the $id of this Book. However, you might instead want to have URLs like: /books/alice-in-wonderland ... in which case, you'd want a route like so: Router::connect( '/books/:slug', array( 'controller' = 'books', 'action' = 'view', ), array( 'slug' = '[-a-z0-9]+', 'pass' = array('slug') ) ); So, Book.slug must be contain only lowercase alpha chars, integers, or hyphens. And your Book model would have: public $actsAs = array( 'Sluggable' = array( 'translation' = 'utf-8', 'separator' = '-', 'label' = 'title', 'length' = 64, 'overwrite' = true ) ); Note the separator is a hyphen. It can also be an underscore, or whatever. Just ensure the route regexp is set up for that. Your action would then be defined as: public function view($slug = null) { Meanwhile, to create a link in a view (other mark-up aside): foreach ($data as $d) { echo $this-Html-link( $d['Book']['title'], array( 'controller' = 'books', 'action' = 'view', 'slug' = $d['Book']['slug'] ), array('title' = 'read this book') ); } Note that 'slug' is passed in the first array, whereas it's in the second array in the route definition. If it's an admin route, you pass 'admin' = 1 in the first array for both link and route, and the URL would be '/admin/...' inthe route. 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
Help on Routes, should we use it ?
Refer to link below: http://book.cakephp.org/view/1541/Routes I don't understand. What does it accomplish ?? Do we normally change the route as shown from the link above ? Thanks, Maxim J. 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 on Routes, should we use it ?
It's simple, If you want to have the the page: http://www.example.com/testpage.html which goes to controller pages_controller and function check(). You need to do: Router::parseExtensions('html'); Router::connect('/testpage', array('controller' = 'pages', 'action' = 'check')); or Router::connect('/testpage.html', array('controller' = 'pages', 'action' = 'check')); On Tue, Dec 28, 2010 at 5:14 PM, John Maxim goog...@gmail.com wrote: Refer to link below: http://book.cakephp.org/view/1541/Routes I don't understand. What does it accomplish ?? Do we normally change the route as shown from the link above ? Thanks, Maxim J. 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 -- Vivi http://photos.vr-3d.net 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 on Routes, should we use it ?
On Tue, Dec 28, 2010 at 10:14 AM, John Maxim goog...@gmail.com wrote: Refer to link below: http://book.cakephp.org/view/1541/Routes I don't understand. What does it accomplish ?? Do we normally change the route as shown from the link above ? Cake's routes default to: /controller/action/param So, if you had a BookController, to view a specific Book, you'd have something like: /books/view/42 ... where 42 is the $id of this Book. However, you might instead want to have URLs like: /books/alice-in-wonderland ... in which case, you'd want a route like so: Router::connect( '/books/:slug', array( 'controller' = 'books', 'action' = 'view', ), array( 'slug' = '[-a-z0-9]+', 'pass' = array('slug') ) ); So, Book.slug must be contain only lowercase alpha chars, integers, or hyphens. And your Book model would have: public $actsAs = array( 'Sluggable' = array( 'translation' = 'utf-8', 'separator' = '-', 'label' = 'title', 'length' = 64, 'overwrite' = true ) ); Note the separator is a hyphen. It can also be an underscore, or whatever. Just ensure the route regexp is set up for that. Your action would then be defined as: public function view($slug = null) { Meanwhile, to create a link in a view (other mark-up aside): foreach ($data as $d) { echo $this-Html-link( $d['Book']['title'], array( 'controller' = 'books', 'action' = 'view', 'slug' = $d['Book']['slug'] ), array('title' = 'read this book') ); } Note that 'slug' is passed in the first array, whereas it's in the second array in the route definition. If it's an admin route, you pass 'admin' = 1 in the first array for both link and route, and the URL would be '/admin/...' inthe route. 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
Form validation and routes - errors lead to controller/action instead of route!
Hey, the problem I have came up very often the last weeks but I couldn't find a solution yet. Maybe one of you has a clue how to do this. The facts: in my users_controller i have an action called register, which is mapped to the route http:://www.domain.com/register This is working, and very easy to set up. But when I now make any mistake in the form given in the register action, the url in the browser switches back to users/register, which is the correct action, but not the correct route! I could do a redirect when an error occurs, but the form validation errors (by model validation OR invalidate()) are gone when a redirect is done. There has to be a solution for this, I just do not want to store all errors in the Session and add the errors manually into the form and delete them afterwards from the Session. Does anyone have any idea how to solve this little problem? Regards, DD 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: Form validation and routes - errors lead to controller/action instead of route!
Hey, ok I found the solution, and it's really simple. Just use the 'url' option for the form, and the routes will be no problem anymore. Here is a brief example how to do it: In Routes-PHP, there is an entry: Router::connect('/register', array('controller' = 'users', 'action' = 'register')); And the form in the view of the register action (views/users/ register.ctp) create the form like this: ?php echo $form-create('User', array('url' = '/register')); ? That points the form to the correct route, which will lead to the correct action. On errors like empty input fields the route will be the same again and everthing works fine. Regards, DD 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: Doubt about admin routes / actions and Auth component
I reversed the order var $components = array('Auth', 'Session'); but it's still not working as expected, i'm running it on cake 1.3.5 On 13 nov, 17:28, cricket zijn.digi...@gmail.com wrote: On Fri, Nov 12, 2010 at 8:20 PM, huoxito huox...@gmail.com wrote: I have this in my app_controller var $components = array('Session', 'Auth'); The order of those should be reversed: var $components = array('Auth', 'Session'); At least, at one time that was important. I don't know if it's still necessary. function beforeFilter(){ parent::beforeFilter(); # thanks tohttp://padariadodenilson.wordpress.com/2010/10/04/criando-uma-area-ad... if (isset($this-params['admin'])) { $this-Auth-deny('*'); } else { $this-Auth-allow('*'); } $this-Auth-fields = array('username' = 'name', 'password' = 'password'); //$this-Auth-loginError = No, you fool! That's not the right password!; //$this-Auth-loginAction = array('admin' = false, 'controller' = 'users', 'action' = 'login'); //$this-Auth-loginRedirect = array('controller' = 'usuarios', 'action' = 'afterLogin'); $this-Auth-authError = Você precisa estar logado para entrar no sistema.; } My routes config are: Router::connect(/admin/:controller/:action/*, array('prefix' = 'admin', 'admin' = true)); What version are you running? In 1.2.x you should have the following in core.php: Configure::write('Routing.admin', 'admin'); For 1.3.x: Configure::write('Routing.prefixes', array('admin')); this way admin methods are protected but if I take off that condition e Auth allows really everything, thanks for helping On 12 nov, 15:50, cricket zijn.digi...@gmail.com wrote: On Thu, Nov 11, 2010 at 11:44 PM, huoxito huox...@gmail.com wrote: Thats what I thought as well, but it doesnt happen, If I just let $this-Auth-allow(‘*’) in my app_controller all actions are accessible without being logged in, even my admin_* methods Perhaps Auth isn't properly configured in AppController::beforeFilter(). Could you post that? 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 That's odd. On a lark, I just added: $this-Auth-allow('*'); .. to my AppController::beforeFilter() and it still redirected me to login when trying to access an admin action. As it's supposed to 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: Doubt about admin routes / actions and Auth component
On Fri, Nov 12, 2010 at 8:20 PM, huoxito huox...@gmail.com wrote: I have this in my app_controller var $components = array('Session', 'Auth'); The order of those should be reversed: var $components = array('Auth', 'Session'); At least, at one time that was important. I don't know if it's still necessary. function beforeFilter(){ parent::beforeFilter(); # thanks to http://padariadodenilson.wordpress.com/2010/10/04/criando-uma-area-administrativa-com-cakephp/ if (isset($this-params['admin'])) { $this-Auth-deny('*'); } else { $this-Auth-allow('*'); } $this-Auth-fields = array('username' = 'name', 'password' = 'password'); //$this-Auth-loginError = No, you fool! That's not the right password!; //$this-Auth-loginAction = array('admin' = false, 'controller' = 'users', 'action' = 'login'); //$this-Auth-loginRedirect = array('controller' = 'usuarios', 'action' = 'afterLogin'); $this-Auth-authError = Você precisa estar logado para entrar no sistema.; } My routes config are: Router::connect(/admin/:controller/:action/*, array('prefix' = 'admin', 'admin' = true)); What version are you running? In 1.2.x you should have the following in core.php: Configure::write('Routing.admin', 'admin'); For 1.3.x: Configure::write('Routing.prefixes', array('admin')); this way admin methods are protected but if I take off that condition e Auth allows really everything, thanks for helping On 12 nov, 15:50, cricket zijn.digi...@gmail.com wrote: On Thu, Nov 11, 2010 at 11:44 PM, huoxito huox...@gmail.com wrote: Thats what I thought as well, but it doesnt happen, If I just let $this-Auth-allow(‘*’) in my app_controller all actions are accessible without being logged in, even my admin_* methods Perhaps Auth isn't properly configured in AppController::beforeFilter(). Could you post that? 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 That's odd. On a lark, I just added: $this-Auth-allow('*'); .. to my AppController::beforeFilter() and it still redirected me to login when trying to access an admin action. As it's supposed to 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: Doubt about admin routes / actions and Auth component
On Thu, Nov 11, 2010 at 11:44 PM, huoxito huox...@gmail.com wrote: Thats what I thought as well, but it doesnt happen, If I just let $this-Auth-allow(‘*’) in my app_controller all actions are accessible without being logged in, even my admin_* methods Perhaps Auth isn't properly configured in AppController::beforeFilter(). Could you post that? 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: Doubt about admin routes / actions and Auth component
I have this in my app_controller var $components = array('Session', 'Auth'); function beforeFilter(){ parent::beforeFilter(); # thanks to http://padariadodenilson.wordpress.com/2010/10/04/criando-uma-area-administrativa-com-cakephp/ if (isset($this-params['admin'])) { $this-Auth-deny('*'); } else { $this-Auth-allow('*'); } $this-Auth-fields = array('username' = 'name', 'password' = 'password'); //$this-Auth-loginError = No, you fool! That's not the right password!; //$this-Auth-loginAction = array('admin' = false, 'controller' = 'users', 'action' = 'login'); //$this-Auth-loginRedirect = array('controller' = 'usuarios', 'action' = 'afterLogin'); $this-Auth-authError = Você precisa estar logado para entrar no sistema.; } My routes config are: Router::connect(/admin/:controller/:action/*, array('prefix' = 'admin', 'admin' = true)); this way admin methods are protected but if I take off that condition e Auth allows really everything, thanks for helping On 12 nov, 15:50, cricket zijn.digi...@gmail.com wrote: On Thu, Nov 11, 2010 at 11:44 PM, huoxito huox...@gmail.com wrote: Thats what I thought as well, but it doesnt happen, If I just let $this-Auth-allow(‘*’) in my app_controller all actions are accessible without being logged in, even my admin_* methods Perhaps Auth isn't properly configured in AppController::beforeFilter(). Could you post that? 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: Doubt about admin routes / actions and Auth component
On Wed, Nov 10, 2010 at 10:26 PM, huoxito huox...@gmail.com wrote: found what i was looking for, guess I just had to add this condition, thanks to this post http://padariadodenilson.wordpress.com/2010/10/04/criando-uma-area-administrativa-com-cakephp/ if (isset($this-params['admin'])) { $this-Auth-deny(‘*’); } else { $this-Auth-allow(‘*’); } Is there a simpler way to do it? You don't need the test. Having $this-Auth-allow(‘*’) should not cause your admin_* methods to be accessible without being logged in as an admin. 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