I got it working, but not very efficiently, I don't think. My problem is how I use views, elements, and layouts. There has to be a better way.
In PostsController, the index() method gets all the posts via $this->Post->findAll(). In the index.thtml view, I provide a form to add a new post. That form submits via Ajax to the add() method in PostsController, and updates the post_index div with the results. Also, in the index.thtml view, I call the post/index element and pass it all the posts. The post/index element displays all the posts. The add() method in PostsController saves the data, and uses $this->layout = 'ajax'. This is where I'm a bit uncertain. I'm not sure if this is the best thing to do. The ajax layout (views/layouts/ajax.thtml) is just a blank file. The add.thtml view also calls the post/index element, so that when the add() method is called, the post_index div is updated with the list of posts. This works, but it seems like it may have problems down the road, or be too complicated. Any recommendations? I don't need any code really, just some advice on the best way to do this. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Cake PHP" 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 -~----------~----~----~----~------~----~------~--~---
