For a while AD7six provided the following. I'm not sure its up-to-date,
it's my version
I can't find the original anymore. The idea is to put your menu in a
component so you load it
only where its needed.
Personally I have a dynamic menu and I build it in the model but I
can't say if its the best approach.
olivvv
### in your controller:
var $components = array('Menu');
var $beforeFilter = array('init');
function init()
{
// Create menu component
$this->Menu->controller = &$this;
$this->Menu->init($this->name);
}
### the menu.php component
<?php
class MenuComponent extends Object {
var $controller = true;
var $MenuItems = array (
array ('home','/') ,
array ('members','/members/'),
array ('experiments','/experiments/'),
array ('CV','/cv/',
array (
array('profile','/cv/#profile'),
array('skill summary','/cv/#skills'),
array('educati?n','/cv/#education'),
array('experience','/cv/#experience'),
array('interests','/cv/#interests')
)
),
array ('FAQs','/faqs/',
array (
array('security','/faqs/security'),
array('privacy','/faqs/privacy')
)
),
array ('contact','/contact/')
);
function init () {
$this->controller->set('MenuItems',$this->MenuItems);
}
}
?>
felle42 wrote:
> Thanks 100rk. setting the variables in bootstrap.php global did it for
> me!
> But why do I have to do this? isn“t the file(bootstrap.php) included
> by a php-include or -require?
>
> I need the global varibals for implementing submenues. I define them as
> an array an the controller selects the right one. is there a better way
> of doing this?
>
> greets
> felle42
>
>
> >
>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---