zend framework - How to initialize db plugin before loading layout.phtml -


i want create menu @ run time depending on user privileges stored in db, used acl grand , revoke resources..

now want load menu depending on user privileges.

here's navigation.phtml sub page

<?php   $resourceloader = new application_plugin_resourceloader();  $namaspace = new zend_session_namespace('zend_auth');   $db = $registry::get('pmodel_db');   $roleid = $namaspace->id;  $module = $resourceloader->getusermodulesprivileges($db, $roleid);   var_dump($module);  ?>  

i load database pmodel_db in bootstrap, face exception

 notice: undefined variable: registry in d:\wamp\www\zend_apps\inspect\application\layouts\scripts\navigation.phtml on line 6. 

the problem means layout.phtml include navigation.phtml page loaded before _initdbregistry() method in bootstrap file..

how can load pmodel_db before loading layout ??

you have use this

 $db = zend_registry::get('pmodel_db'); 

the problem means layout.phtml include navigation.phtml page loaded before _initdbregistry() method in bootstrap file

you wrong here, zend won't dispatch request until bootstrap resources required.

the way accessing registry wrong.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -