How-to URL modification
Hi! I'm a CakePhp beginner. In my app, users can view their details from, http://myapp/users/view/userid. But I what I want is, http://myapp/userid. How do I do 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: How-to URL modification
In your users controller (cake 2.0): function view($id = null) { if (!empty($this-request- params['userid'])) { $id = $this-request-params['userid']; } ...} In your routes.php:Router::connect('/:userid', array('controller' = 'users', 'action' = 'view'), array('userid' = '[0-9]+')); If userid can be username (eg: contain non-numbers) you will have to modify array('userid' = '[0-9]+') to account for that On Nov 13, 2:02 pm, Sushil Gupta desus...@gmail.com wrote: Hi! I'm a CakePhp beginner. In my app, users can view their details from,http://myapp/users/view/userid. But I what I want is,http://myapp/userid. How do I do 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: How-to URL modification
Links to the relevant book pages: http://book.cakephp.org/view/945/Routes-Configuration // 1.3 http://book.cakephp.org/2.0/en/development/routing.html#routes-configuration // 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