easily extend upon you might wanna look at wildflower which is a cms
built in cakephp
Good luck
Sean
On Nov 27, 2:46 pm, "Arthur Pemberton" <pem...@gmail.com> wrote:
> On Wed, Nov 26, 2008 at 7:20 PM, Dan Bair <dan.b...@yahoo.de> wrote:
>
> > 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 ));
> > }
> > }
>
> This worked very well.
>
> Thank you.
>
> > 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.
>
> All my static html should not go deeper than the root.
>
> One additional question:
>
> How troublesome would it be to have the 'pages' controller also check
> the web root for .html files?
>
> ie:
>
> example.com/pagename -> WWW_ROOT.DS.$pagename.'.html' ?
>
> --
> Fedora 9 : sulphur is good for the skin
> (www.pembo13.com)- Hide quoted text -
>
> - Show quoted text -
--~--~---------~--~----~------------~-------~--~----~
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+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---
No comments:
Post a Comment