Put that call in a method, instead of just stranded in the middle of a
class definition...
class AppController extends Controller {
var $uses = array ( 'NavMenu' );
function beforeRender() {
$this->set ( 'primaryNav', $this->NavMenu->find ( 'all' ) );
}
}
On Dec 10, 12:11 pm, Rob Wilkerson <[EMAIL PROTECTED]> wrote:
> On Dec 7, 1:51 pm, Rob <[EMAIL PROTECTED]> wrote:
>
> > Just do a find on your NavMenu in the model you are driving your view
> > from, and then you can access the data from your element.
>
> Okay, I'd like to pretend that I'm not getting my ass thoroughly
> kicked by this, but...doing so isn't helping me sort this out. The
> solution I'm trying at the moment is this: tell the AppController to
> use the NavMenu model and then create a getMenuItems() function that
> accepts a parameter indication which menu should be retrieved. The
> function would return an array of menu items for that menu.
> Unfortunately, I'm not getting very far at all.
>
> For the moment, I just have this to see what I can see:
>
> class AppController extends Controller {
> var $uses = array ( 'NavMenu' );
>
> $this->set ( 'primaryNav', $this->NavMenu->find ( 'all' ) );
>
> }
>
> What I see is an error in the set() method call: Parse error: syntax
> error, unexpected T_STRING, expecting T_FUNCTION in /path/to/my/app/
> app_controller.php on line 42.
>
> Look, I know I'm probably doing something incredibly stupid here, but
> the documentation just doesn't offer any help at all for including
> dynamic content in a layout and my frustration is starting to show.
> Can someone point me in the right direction and, if possible, provide
> some very lightweight, dummy code that helps me put the pieces
> together? requestAction() seems to be a discouraged solution these
> days, so I'm trying a different route, but I'm not sure that it's the
> "cake way", nor can I find much information about what the "cake way"
> actually is for this scenario.
>
> I appreciate the help folks have tried to give so far, I'm just to new
> to Cake to skip steps. I need the remedial version, it's become quite
> clear. :-)
>
> Thanks.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---