So I'm having a crack at using a component.
My component (nav.php) looks like this:
class NavComponent extends Object
{
var $menu = null;
function doNav()
{
$this->menu = "testing"; //just for testing purposes
}
}
In my app_controller.php I have:
class AppController extends Controller {
var $uses = array('Node');
var $components = array('othAuth', 'nav'); // necessary, we need to
have the othauth component so it can do it's business logic
var $helpers = array('Html', 'OthAuth', 'Tree'); // html is always
needed, othauth helper is not a must, but you can do some cool things
with it (see later on)
var $othAuthRestrictions = array( 'add','edit','delete'); // these
are the global restrictions, they are very important. all the
permissions defined above are weighted against these restrictions to
calculate the total allow or deny for a specific request.
function beforeFilter()
{
$this->nav->doNav(); //call the component here
$auth_conf = array(
'mode' => 'oth',
'login_page' => '/users/login',
'logout_page' => '/users/logout',
'access_page' => '/',
'hashkey' => 'MySEcEeTHaSHKeYz',
'noaccess_page' => '/users/noaccess',
'strict_gid_check' => false);
$this->othAuth->controller = &$this;
$this->othAuth->init($auth_conf);
$this->othAuth->check();
}
}
When I try to refer to the $menu variable in my layout (echo $menu;) I
get this error:
Notice: Undefined variable: menu in C:\wamp\www\cake\app\views\layouts
\default.thtml on line 19
Any ideas? Am I even heading in the right direction?
Thanks again.
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---