I've always just gone with an edit action that does both new and
edit. Then I can use the existence/lack of an id to tell them apart.
So on the view I can do:
if ($this->data['Post']['id']) {
echo 'Edit Post';
} else {
echo 'New Post';
}
I prefer this to having two views and an element, since it's only one
view to manage and one controller action.
If I really wanted /Post/add url I would just add a route and point it
to the edit action.
-Matt
www.pseudocoder.com
On Jul 17, 12:27 am, beetlecube <[EMAIL PROTECTED]> wrote:
> ... editpost and newpost pages.
>
> I'm creating a mini-discussion forum, and not sure whether or not to
> have the "new post" and "edit post" pages just simply combined.
> But I don't want the URL bar to say "edit" if someone is creating a
> new post. (The other aspects of how to do it this way are of course
> easy: just have a single edit controller to save() without an id, or
> save() with an id)
>
> Is there an easy to use two controllers, but only have to maintain the
> code for one single form ? Does anyone use it this way.
> I'm thinking maybe use the two views (of course, since you have two
> controllers), but use an element that holds the Form and import this
> element where you need it?
>
> Thanks
--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---