If you're going to be having a lot of static pages, it may be worth your while to use Cake's Folder and File objects. You can loop through the .ctp files assign the routes dynamically.
Here's a quick snippet that will go through all of the .ctp files in the pages directory. This will be in app/config/routes.php App::import( 'Core', 'Folder' ); $path = APP . 'views' . DS . 'pages' . DS; $files = new Folder( $path ); $p = $files->find( '(.+)\.ctp' ); foreach( $p as $file ){ if( file_exists( $path . $file ) ){ $tmp = str_replace( $path, '', substr( $file, 0, (strlen ($file)-4) ) ); Router::connect('/' . $tmp, array('controller' => 'pages', 'action' => 'display', $tmp )); } } Do note that this won't recursively get all of the files. You'll need to use the Folder::findRecursive method if you'll be using additional directories for your static pages. On Nov 26, 3:41 pm, "Sam Sherlock" <[EMAIL PROTECTED]> wrote: > If you want to remove the /pages/ from the url you'd need to write some > custom routes > see the preset example for the home page which sets yourdomain.com/ to > display views/pages/home.ctp > > eg > Router::connect('/', array('controller' => 'pages', 'action' => > 'display', 'home')); > > so > /about -> views/pages/about.ctp > Router::connect('/about', array('controller' => 'pages', 'action' => > 'display', 'about')); > > 2008/11/26 Arthur Pemberton <[EMAIL PROTECTED]> > > > > > On Wed, Nov 26, 2008 at 4:18 PM, James K <[EMAIL PROTECTED]> wrote: > > > > For static pages, just add them to views/pages/ > > > > Name them with a .ctp extension > > > > You should be able to reach those pages by simply going to > > > yourdomain.com/pages/staticpagename and it'll wrap that content in the > > > default layout. > > > Is the process different to have them at the root of the website? > > (Where I most if not all my static pages would need to be) > > > -- > > Fedora 9 : sulphur is good for the skin > > (www.pembo13.com) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---