Yes, elements are the way to go with this. Think of elements as pieces
you can use in your views. If memory serves me correctly, all the
variables in the view should be available in your element as well. So,
if you have a controller action that uses $this->set('variable', 'some
information'), $variable will be available in your view and in your
element.On Mar 22, 7:40 am, "djiize" <[EMAIL PROTECTED]> wrote: > I think you're lokking for "elements"http://manual.cakephp.org/chapter/views > in section 1, subchapter Elements > > On 22 mar, 15:12, "beetlecube" <[EMAIL PROTECTED]> wrote: > > > HI, I'm using cake v1.2 > > > My question relates to content_for_layout (I think), and for the > > past hour I've been reading the results of a group search for this > > search term, but couldn't find an answer. > > > My views are more or less PHP code that iterates through the results > > of an amazon product lookup. And really, the code is the same, except > > for the very small that changes from view to view... and that is the > > amazon searchindex such as 'books', 'dvd', etc.. > > > So I took out the generic php look-up and "looping" code and put that > > it in a file called generic.php. (I don't know where to put that). > > And now, each of my views is stripped down to just: > > > == books/index.thtml== > > $searchindex = 'Books' > > $display_string = "best selling books"; > > > ==dvds/index.thtml== > > $searchindex = 'dvds' > > $display_string = "best selling DVD's"; > > > However, I have no clue on how to get that generic.php "included". > > > I tried the obvious thing, i.e., in each view, just put "include > > 'generic.php', below the top two php assignments but of course I > > didn't expect that to work, because of the way that cakephp is built > > -- it makes you use its own keywords. > > > Is there an easy way of doing this. Should I be editing the layout/ > > default.thml file? > > > Thanks for reading this, > > Steve --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
