I found this but every url takes me to pages now...
http://paulherron.net/articles/view/managing_simple_pages_in_cakephp
Routes:
App::import('model', 'Page');
$Page = new Page();
$pages = $Page->find('list', array('fields' => array('id',
'title')));
//debug($pages);
Router::connect('/:page/*', array('controller' => 'pages'),
array('page' => implode($pages, '|')));
Pages controller
function index() {
if (!$id) {
$this->Session->setFlash(__('Invalid Page.', true));
$this->redirect(array('action'=>'index'));
}
$this->set('page', $this->Page->read(null, $id));
}
Any ideas where I am going wrong?
Rhanks
Dave
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf
Of Jeremy Burns
Sent: January-28-10 2:44 AM
To: [email protected]
Subject: Re: Best approach for Pages
I built an 'about' controller with a function for each page, then used
routing to remove the 'about' part from the url.
Jeremy Burns
On 28 Jan 2010, at 06:10, Dave 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
<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 [email protected]
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
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 [email protected] To
unsubscribe from this group, send email to
[email protected] 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 [email protected]
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