Elements are definitely the way to go. I make extensive use of elements for common display items.
On the other hand, if you are just driving a common navigation, I'm not sure you need an element since it can just go directly into the layout. On Dec 7, 5:24 am, Rob Wilkerson <[EMAIL PROTECTED]> wrote: > Rob Wilkerson wrote: > > I'm so new to Cake that I'm honestly not even sure how to best ask > > this question (much less search to see whether it's been asked), so > > I'm going to describe what I have and allow the question of how best > > to achieve the result to be implied. > > > I have a layout (my default layout) that includes 3 different > > navigation menus (primary, secondary, tertiary). Those menus are data > > driven - I have a nav_menus table that hasAndBelongsToMany > > nav_menu_items. I'd like to populate those menu instances dynamically > > in each place where they belong on the layout. I'd like to share the > > logic that will retrieve the items based on the menu and use that to > > output the expected markup: > > > <ul class="alternate-nav"> > > <li class="first">Home</li> > > <li>Directions</li> > > <li class="last">Contact</li> > > </ul> > > > I'm not sure where to look to get started. I have dug around some, but > > I haven't seen anything that seems to address this particular need in > > a way that I can digest it as such. > > > Thanks. > > I got pulled away from this for a while, but I'm trying to get back to > it so I wanted to revisit this question. validkeys suggested using a > component, but the more I look at it the less it seems right (at least > from a total n00b's perspective). I'm trying to insert data-driven > output into a _layout_. If I use a component, then I'd have to specify > the use of that component for every controller that uses that > template. > > Is there not a more "universal" way to tell the template to include > dynamic content? It seems like an element (provided I can figure out > how to give it data access without breaking encapsulation) is the > right way to go. > > Any thoughts? --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
