What bugs me is that they are conceptually different views of a model,
not reusable web page elements -- i.e. they are not menus, sidebars,
headers, footers... With that kind of architecture, I'd end up with
"customer" controller retrieving and passing "inquiry" data to
"customer" view, which then distributes that data to various "inquiry"
elements for actual viewing/rendering. I would expect that to be the
job of the "inquiry" controller/view pair instead, wouldn't you?
On Oct 17, 1:54 am, "David C. Zentgraf" <[EMAIL PROTECTED]> wrote:
> I don't see the problem with using elements, that's exactly what they
> were made for.
>
> Layouts: outer wrapper, same for all pages (or very few different
> variations)
> Views: the actual "page", usually one per action
> Elements: re-usable pieces of a view that are the same on many pages
>
> You can put the elements in sub-directories if you don't want them to
> clutter up one directory. A renderAction() is overkill here.
>
> On 17 Oct 2008, at 12:05, Stan wrote:
>
>
>
> > From what I could gather in other posts, it seem like the right way to
> > do this is through requestAction, although there are a few things
> > which don't seem right. Let me very briefly explain my setup which
> > should be fairly common.
>
> > I have 2 tables, customers, and inquiries. Customers hasMany
> > inquiries. I baked a project/models/views for these, and customers/
> > view will show me my customer info, along with all inquiries belonging
> > to the customer.
>
> > In customers/view.ctp, there is some code to render an inquiry. Also,
> > inquiries/view.ctp has the same code to render an inquiry. My first
> > thought was -- I don't want the same code in two places... I want to
> > define how an inquiry should be rendered in inquiry/view.ctp, and then
> > use that in customers/view.ctp. Also, I might want to have a couple of
> > different views of an inquiry -- maybe a view_full.ctp,
> > view_summary.ctp, view_oneline.ctp...
>
> > There are a couple of options that I could find:
>
> > I can use renderAction ("/inquiries/view_expanded/$id",
> > array('return')) and get what I want... but, that causes a whole new
> > page request, and the inquiry data which was already available to the
> > customer view has to be retrieved again.
>
> > I can use an element, and pass the inquiry data to it. Sounds great,
> > except now I have to create a different element for each inquiry view
> > I want to include in various pages -- inquiry_expanded.ctp,
> > inquiry_summary.ctp, inquiry_online.ctp, etc. Soon, I'm going to have
> > a few elements for each model and that's not what elements are
> > supposed to be for -- that's exactly why there are views.
>
> > What is the proper "cake-way" of doing this?
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---