Welcome, Guest. Register Now!
   
Mark Forums Read Mark Forums Read Mark Forums Read


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-31-2007, 11:29 AM
Junior Member
 
Join Date: May 2007
Posts: 1
Question Getting Modules to work

I am using Zend Framework RC 1 and I am trying to get modules working correctly, this is my directory structure:
Quote:
/
--/application
---/modules
----/admin
------/controllers
--------IndexController.php
------/models
------/views
----/default
------/controllers
--------IndexController.php
------/models
------/views
--/library
--/public
/.htaccess
/index.php
in my index.php I have the following set up:

Code:
require_once 'Zend/Loader.php';
Zend_Loader::loadClass('Zend_Controller_Front');
Zend_Loader::loadClass('Zend_Registry');
Zend_Loader::loadClass('Zend_Db');
Zend_Loader::loadClass('Zend_Db_Table');
$controller = Zend_Controller_Front::getInstance();
$controller->addModuleDirectory('./application/modules');
$controller->dispatch();
When i browse to http://host/ I do get the correct output from default/controllers/Indexcontroller's indexAction function, however, when I browse to http://host/admin/ I get nothing

Also, both are giving me the following error (it appears below my echo statement in the default indexcontroller):
Quote:
Fatal error: Uncaught exception 'Zend_Controller_Dispatcher_Exception' with message 'Invalid controller specified (error)' in
D:\Work\LR\library\Zend\Controller\Dispatcher\Stan dard.php:189 Stack trace:
#0 D:\Work\LR\library\Zend\Controller\Front.php(889):
Zend_Controller_Dispatcher_Standard->dispatch(Object(Zend_Controller_Request_Http), Object(Zend_Controller_Response_Http))
#1 D:\Work\LR\index.php(50):
Zend_Controller_Front->dispatch() #2 {main} thrown in D:\Work\LR\library\Zend\Controller\Dispatcher\Stan dard.php on line 189
__________________
www.glasscube.co.za

Last edited by blunt : 05-31-2007 at 12:14 PM.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 05-31-2007, 11:50 AM
Super Moderator
 
Join Date: May 2007
Location: netherlands
Posts: 2
Default

Try putting the following controller in your default section:

PHP Code:
class ErrorController extends Zend_Controller_Action {

    public function 
errorAction() {
        
$this->_helper->viewRenderer->setNoRender();
        
//no render!
        
$errors $this->getRequest()->getParam('error_handler');
        echo 
$errors->exception;
    }



the error handler (default enabled in rc1) is trying to send you to ErrorController::errorAction(). It doesn't exist.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 06-15-2007, 03:48 AM
Junior Member
 
Join Date: Feb 2007
Posts: 26
Default

I had the same problem. But I solved it. In declaring Admin Controller, make sure you use thise declaration in IndexController.php in Admin/Controllers

Code:
class Admin_IndexController extends Zend_Controller_Action {
    	public function indexAction(){
    	}
}
Note the text Admin_IndexController. And make sure, in admin/view/scripts directory, you have a folder index and index.phtml inside.

Hope it helps
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 06-16-2007, 06:35 AM
SpotSec's Avatar
Senior Member
 
Join Date: Feb 2007
Location: United States
Posts: 121
Default

Actually the folder index and the file index.phtml are not required if you decide not to use the ViewRenderer helper.
__________________
Zym Framework - A Zend Framework extension library w/ demo app

SpotSec Blog:
http://spotsec.com/blog
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 10:38 PM.