Thursday, January 28, 2010

RE: Best approach for Pages

No, I need these pages to be dynamic. There was an article on using /
making your own page controller

http://paulherron.net/articles/view/managing_simple_pages_in_cakephp

But I cant seem to get it to work.

I do not want to hard code about / history so on since the site owner may
add new pages as the site grows. They may add a new "page" called "bio" for
example then site/bio will pull bio page using the pages controller.

Any ideas?

Thanks,

Dave

-----Original Message-----
From: cake-php@googlegroups.com [mailto:cake-php@googlegroups.com] On Behalf
Of cricket
Sent: January-28-10 2:51 PM
To: CakePHP
Subject: 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
cake-php+at http://groups.google.com/group/cake-php?hl=en

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: