The simplest solution is to copy the code from the add method of the
controller to the index method.
Not looked at the blog code for quite a while, but it would go
something like this:
function index() {
if ($this->data) {
// add form submitted
$this->Model->create();
if ($this->Model->save($this->data)) {
// data saved
}
else {
// data failed to save
}
// rest of index code
$this->set("data", $this->Model->find("all"));
}
On Jan 18, 10:39 am, Zach <[email protected]> wrote:
> Hi All. I've gone through the blog tutorial and i'm trying to make my
> first cake site. My site is more or less the same as the blog
> tutorial, except I want the add view and the index view to be the same
> thing (one page that collects and displays posts, like a comment
> thread).
>
> Do i have to have an add view? Can I redirect somehow?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---