Re: SEO friedly URLs
Hi, You can use the static slug() method of the Inflactor class to create the slug of a string. Read this part of the documentation: http://book.cakephp.org/2.0/en/core-utility-libraries/inflector.html?highlight=slug#Inflector::slug And you can use it like: Inflector::slug($word, $replacement = '_') Inflector::slug(My string has to be a slug, '-'); would return my- string-has-to-be-a-slug bye On nov. 11, 15:56, euromark dereurom...@googlemail.com wrote: the urls can stll be underscore and lowercase MyController.php etc but /my_controller/action_name etc On 11 Nov., 05:16, Andras Kende and...@kende.com wrote: Kevin, seo friendly urls in cakephp are very very easy… below is the basic idea to do domain.com/video/return-of-the-jedi instead of domain.com/videos/view/1 videos database table (add a slug field) id | name | slug | … 1 | Return of the Jedi | return-of-the-jedi | …. routes.php Router::connect('/video/:slug', array('controller' = 'videos', 'action' = 'view'), array('pass' = array('slug'))); controller: public function view($id = null) { $video = $this-Video-find('first', array( 'conditions' = array('Video.slug' = $id), )); $this-set(compact('video')); } Andras Kende On Nov 10, 2011, at 1:26 PM, Kervin L. Pierre wrote: One CakePHP convention I have to go against is the ‘underscore’ and ‘camel-case’ convention in URLs. Have underscores and camel case in the source and database names is fine. But in the URLs it’s a SEO issue that needs to be avoid. Is there anyway to have dashes and all lower case names besides… http://klauzinski.com/php/cakephp/search-engine-friendly-urls-in-cakephp The above article was written 2 years ago. And I’m planning on using CakePHP 2.0. The article also mentions that it breaks reverse routes. Best regards, Kervin -- Our newest site for the community: CakePHP Video Tutorialshttp://tv.cakephp.org Check out the new CakePHP Questions sitehttp://ask.cakephp.organdhelp others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: SEO friedly URLs
the urls can stll be underscore and lowercase MyController.php etc but /my_controller/action_name etc On 11 Nov., 05:16, Andras Kende and...@kende.com wrote: Kevin, seo friendly urls in cakephp are very very easy… below is the basic idea to do domain.com/video/return-of-the-jedi instead of domain.com/videos/view/1 videos database table (add a slug field) id | name | slug | … 1 | Return of the Jedi | return-of-the-jedi | …. routes.php Router::connect('/video/:slug', array('controller' = 'videos', 'action' = 'view'), array('pass' = array('slug'))); controller: public function view($id = null) { $video = $this-Video-find('first', array( 'conditions' = array('Video.slug' = $id), )); $this-set(compact('video')); } Andras Kende On Nov 10, 2011, at 1:26 PM, Kervin L. Pierre wrote: One CakePHP convention I have to go against is the ‘underscore’ and ‘camel-case’ convention in URLs. Have underscores and camel case in the source and database names is fine. But in the URLs it’s a SEO issue that needs to be avoid. Is there anyway to have dashes and all lower case names besides… http://klauzinski.com/php/cakephp/search-engine-friendly-urls-in-cakephp The above article was written 2 years ago. And I’m planning on using CakePHP 2.0. The article also mentions that it breaks reverse routes. Best regards, Kervin -- Our newest site for the community: CakePHP Video Tutorialshttp://tv.cakephp.org Check out the new CakePHP Questions sitehttp://ask.cakephp.organd help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group athttp://groups.google.com/group/cake-php -- Our newest site for the community: CakePHP Video Tutorials http://tv.cakephp.org Check out the new CakePHP Questions site http://ask.cakephp.org and help others with their CakePHP related questions. To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php
Re: SEO friedly URLs
Kevin, seo friendly urls in cakephp are very very easy… below is the basic idea to do domain.com/video/return-of-the-jedi instead of domain.com/videos/view/1 videos database table (add a slug field) id | name | slug | … 1 | Return of the Jedi | return-of-the-jedi | …. routes.php Router::connect('/video/:slug', array('controller' = 'videos', 'action' = 'view'), array('pass' = array('slug'))); controller: public function view($id = null) { $video = $this-Video-find('first', array( 'conditions' = array('Video.slug' = $id), )); $this-set(compact('video')); } Andras Kende On Nov 10, 2011, at 1:26 PM, Kervin L. Pierre wrote: One CakePHP convention I have to go against is the ‘underscore’ and ‘camel-case’ convention in URLs. Have underscores and camel case in the source and database names is fine. But in the URLs it’s a SEO issue that needs to be avoid. Is there anyway to have dashes and all lower case names besides… http://klauzinski.com/php/cakephp/search-engine-friendly-urls-in-cakephp The above article was written 2 years ago. And I’m planning on using CakePHP 2.0. The article also mentions that it breaks reverse routes. Best regards, Kervin -- 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