Combining Edit and Create views?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Combining Edit and Create views?

dieter randolph

Hello!  I'm in the middle of my first Cake PHP project, and, though I'm
thrilled about working in this environment, I have a lot of lame newbie
questions -- here's the one I'm wrestling with now:

I've noticed that the views for Edit and Create are very similar, and
that it might make sense to combine them; unfortunately, I can't seem
to figure out how to specify a layout within a given action (I know how
to do it at the Controller level, but I need to go deeper, for obvious
reasons).  The Ruby on Rails version of what I'm talking about is
discussed at
http://wiki.rubyonrails.com/rails/pages/HowToReuseEditViewsForNewViews,
if that makes more sense than what I'm trying to describe here.

I'm sure this is a basic issue that I'm just not getting; thanks in
advance for your patience.  Any guidance you can offer would be a big
help.

Thanks again,
Dieter


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "Cake PHP" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Combining Edit and Create views?

Samuel DeVore

i use elements ( see http://manual.cakephp.org/chapter/views  about
half way down)

for the common form element parts of these two views

On 11/7/06, dieter.randolph <[hidden email]> wrote:

> Hello!  I'm in the middle of my first Cake PHP project, and, though I'm
> thrilled about working in this environment, I have a lot of lame newbie
> questions -- here's the one I'm wrestling with now:
>
> I've noticed that the views for Edit and Create are very similar, and
> that it might make sense to combine them; unfortunately, I can't seem
> to figure out how to specify a layout within a given action (I know how
> to do it at the Controller level, but I need to go deeper, for obvious
> reasons).  The Ruby on Rails version of what I'm talking about is
> discussed at
> http://wiki.rubyonrails.com/rails/pages/HowToReuseEditViewsForNewViews,
> if that makes more sense than what I'm trying to describe here.
>
> I'm sure this is a basic issue that I'm just not getting; thanks in
> advance for your patience.  Any guidance you can offer would be a big
> help.
>
> Thanks again,
> Dieter
>
>
> >
>


--
==
S. DeVore
(the old fart) the advice is free, the lack of crankiness will cost you

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "Cake PHP" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Combining Edit and Create views?

Russell Austin
In reply to this post by dieter randolph

I think you are asking how to render a different view.

If you have an action called "new" but want to use edit.thtml for your
view, then inside your action call

$this->render('edit');

But if you were in fact asking how to use a different layout, then you
can use

$this->layout = 'other_layout';

These topics are covered in manual sections for controllers and views,
if you need further explanation.


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "Cake PHP" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Combining Edit and Create views?

dieter randolph

Works like a charm -- I knew it was something silly like that.  Thanks
for your time!

-d.

On Nov 7, 12:09 pm, "Russell Austin" <[hidden email]> wrote:

> I think you are asking how to render a different view.
>
> If you have an action called "new" but want to use edit.thtml for your
> view, then inside your action call
>
> $this->render('edit');
>
> But if you were in fact asking how to use a different layout, then you
> can use
>
> $this->layout = 'other_layout';
>
> These topics are covered in manual sections for controllers and views,
> if you need further explanation.


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "Cake PHP" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---