Page 1 of 1
Zend Framework -modules
Posted: Wed Apr 07, 2010 8:21 am
by ajlisowski
Hey all, I am not sure if anyone here has any experience with Zend Framework. I am trying to get modules working correctly and am struggling.
Basically I have used zend tools to create a project and then create some modules.
I have set up my module directory in the config file but when I go to localhost/mysite/public/modulename
it says page not found. Any idea what I am doing wrong?
Re: Zend Framework -modules
Posted: Wed Apr 07, 2010 9:14 am
by lunarnet76
do you have an .htaccess that redirects everything to your index.php ?
Could you give us like maybe your entire index.php otherwise!
Re: Zend Framework -modules
Posted: Wed Apr 07, 2010 9:17 am
by lunarnet76
My code is simply
Code: Select all
$frontController=Zend_Controller_Front::getInstance();
$frontController->setControllerDirectory(array(
'default' => 'module/default/controller',
'manager' => 'module/manager/controller',
'admin' => 'module/admin/controller'
));
Re: Zend Framework -modules
Posted: Wed Apr 07, 2010 9:23 am
by ajlisowski
I did not have an htaccess.
I somehow managed to fix it and get things working right. I honestly have no idea what I did different this time. I basically created a project, created a module, created the index controller for it and then added the following to my config
resources.frontController.moduleDirectory = APPLICATION_PATH "/modules"
resources.modules[] = ""
I have an empty bootstrap.php and a default index.php
Code: Select all
// Define path to application directory
defined('APPLICATION_PATH')
|| define('APPLICATION_PATH', realpath(dirname(__FILE__) . '/../application'));
// Define application environment
defined('APPLICATION_ENV')
|| define('APPLICATION_ENV', (getenv('APPLICATION_ENV') ? getenv('APPLICATION_ENV') : 'production'));
// Ensure library/ is on include_path
set_include_path(implode(PATH_SEPARATOR, array(
realpath(APPLICATION_PATH . '/../library'),
get_include_path(),
)));
/** Zend_Application */
require_once 'Zend/Application.php';
// Create application, bootstrap, and run
$application = new Zend_Application(
APPLICATION_ENV,
APPLICATION_PATH . '/configs/application.ini'
);
$application->bootstrap()
->run();
Maybe it was due to me naming my modules in capital letters to start? I have no idea. Im sure Ill manage to break something, somewhere though. So, Ill be back
I have a ton to learn about ZF. Right now I am simply using zend tools to set up my project but I think that is screwing me out of actually learning how the framework is setup and what I should use my bootstrap to accomplish.
Re: Zend Framework -modules
Posted: Wed Apr 07, 2010 11:28 am
by ajlisowski
Ugh, now ive spent another hour trying to figure out why my module isnt looking in the /forms folder for forms.
I have a basic site going, building through multiple tutorials. My default module is built off a tutorial and contains an album form.
I am building a login module and in it I am trying to create a form but it breaks the site (note: for some reason, despite all error messaging being on, all I get is a white screen...)
however, this works:
$form = new Application_Form_Album();
because that form is stored in the default module form folder.
$form = new Login_Form_Login();
does not work, because it is stored in /modules/login/forms
Everything ive read said that it should work since the autoloader is going for each module (on account of resources.modules[]='"" in my config) and the class name being correct allowing it to map it to Module_Form_Name modules/module/forms/name
Again, not sure what is happening. Blah.
Re: Zend Framework -modules
Posted: Wed Apr 07, 2010 2:38 pm
by ajlisowski
Ive fixed the form issue. Apparently I needed to have an empty module bootstrap in the module. It appears to be all good.