Alex Tech Adventures The webs best tutorials!

Welcome, Guest
Please Login or Register.    Lost Password?

Zend Framework 1.9 tutorials
(1 viewing) (1) Guest
Go to bottomPage: 1
TOPIC: Zend Framework 1.9 tutorials
#262
Zend Framework 1.9 tutorials 2 Years, 1 Month ago Karma: 0
Hi all,

i was following the tutorials given here:-

i got everything working until this tutorial "Zend Framework greetings to 1.9" but after following this tutorial "Zend Framework 1.9 tutorial 10 modular application part 1"
the fact is that inorder to get modular structure i copied LibraryAcl.php file to modules/default/models folder

I am getting the error Class 'Model_LibraryAcl' not found in /var/www/zftutorial/application/Bootstrap.php

the line corresponding to this in Bootstrap.php is $this->_acl = new Model_LibraryAcl(); so how should this line be changed ?


my Bootstrap.php file is as follows:-


<?php

class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
private $_acl = null;
// private $_auth = null;

protected function _initAutoload()
{
$moduleLoader = new Zend_Application_Module_Autoloader(array(
'namespace' => '',
'basePath' => APPLICATION_PATH));

if(Zend_Auth::getInstance()->hasIdentity())
{
Zend_Registry::set('role',Zend_Auth::getInstance()->getStorage()->read()->role);
/*
if Zend_Auth has an instance or an user is actually logged in , access his role
setting a variable which is visible across whole application
*/
}
else
{
Zend_Registry::set('role','guest');
}

$this->_acl = new Model_LibraryAcl();
// $this->_acl = new Default_Model_LibraryAcl();
$this->_auth = Zend_Auth::getInstance();
/*current role will be taken from this variable*/



$fc = Zend_Controller_Front::getInstance();
/*get instance of front controller*/
$fc -> registerPlugin(new Plugin_AccessCheck($this->_acl/*,$this ->_auth*/));



return $moduleLoader;
}

function _initViewHelpers()
{
//layout resource does not come by default in zend framework as of 1.8
$this->bootstrap('layout');
/*initializing the layout resource*/

$layout = $this->getResource('layout');
/*to get the layout object*/

$view = $layout->getView();
/* getting the view of the layout object*/

$view->doctype('XHTML1_STRICT');
$view->headMeta()->appendHttpEquiv('Content-Type', 'text/html;charset=utf-8')
->appendName('description','using view helpers in Zend view') ;

$view->headTitle()->setSeparator(' - ');
$view->headTitle('Zend Framework tutorial');
/*using view helpers*/

$navContainerConfig = new Zend_Config_Xml(APPLICATION_PATH . '/configs/navigation.xml','nav') ;
/*class that grabs configuration file and puts it into array format*/

$navContainer = new Zend_Navigation($navContainerConfig);
$view -> navigation($navContainer)->setAcl($this->_acl)->setRole(Zend_Registry::get('role')/*$this->_auth->getStorage()->read()->role*/);


}
}
atcelsius
Fresh Boarder
Posts: 1
graphgraph
User Offline Click here to see the profile of this user
Last Edit: 2009/12/22 01:44 By atcelsius.
The administrator has disabled public write access.
 
#264
Re:Zend Framework 1.9 tutorials 2 Years, 1 Month ago Karma: 16
Hello and welcome to my forums

So far i see a problem with your namespace for default module. In order for new Model_LibraryAcl(); to work once it moves into default modules, namespace for default needs to be updated:
$modelLoader = new Zend_Application_Module_Autoloader(array(
'namespace' => '',
'basePath' => APPLICATION_PATH.'/modules/default'));

Lets start troubleshooting from here and see how far this goes.
alexanderrv
Administrator
Posts: 279
graph
User Offline Click here to see the profile of this user
Gender: Male tmthv2 alexchatonly@hotmail.com Location: Freeport, Bahamas Birthdate: 1989-04-14
The administrator has disabled public write access.
 
Go to topPage: 1
Moderators: alexanderrv
You are here: Home Forum

Statistics

Members : 1388
Content : 42
Web Links : 1
Content View Hits : 190529

Poll

Interested in TinyBrowser and TinyMce plugin for ZF?
 

Who's Online

We have 35 guests online