Thursday, January 28, 2010

Re: Best approach for Pages

Router::connect('/', array('controller' => 'pages', 'action' =>
'display', 'index'));
Router::connect('/about', array('controller' => 'pages', 'action' =>
'display', 'about'));
Router::connect('/info', array('controller' => 'pages', 'action' =>
'display', 'info'));
Router::connect('/history', array('controller' => 'pages', 'action' =>
'display', 'history'));
Router::connect('/contact', array('controller' => 'pages', 'action' =>
'display', 'contact'));

That's for static files. Since these will be dynamic, you could create
a new method in pages_controller, eg.

Router::connect('/', array('controller' => 'pages', 'action' =>
'fetch', 'index'));

On Jan 28, 1:10 am, "Dave" <make.cake.b...@gmail.com> wrote:
> I have to build a simple site, 5 pages but the tricky part seems to be the
> pages are index, about us, info, history and contact us so the urls need to
> be reflected by that (site/about_us.... site/contact) and the only thing on
> these pages will be text. Admin logs in and using wysiwyg editor can update
> the content for these pages. I do not want to build 5 controllers since
> everything can be done with 1 "pages" controller. So my question is how can
> this be done and if using 1 controller what would you name this controller
> since "pages" is the obvious choice but that's set aside for stoic pages and
> can you set routes for the text urls using 1 controller?
>
> Any ideas / suggestions would be great.
>
> Thanks,
>
> Dave

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+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en

No comments: