Reputation: 350
Need to call some function from another controller (not IndexController), for example:
class IndexController extends Zend_Controller_Action
{
public function indexAction()
{
$someFunction = new CustomController();
$someFunction->someFunc();
}
} But this throws an error :
Fatal error: Class 'CustomController' not found in C:\xampp\htdocs\demo.ru\application\controllers\IndexController.php on line 13
Upvotes: 2
Views: 3628
Reputation: 11853
If YourController::memberFunction()
does something that is needed across multiple controllers, put that code in a action helper or library class,
so that both controllers can access the shared functionality without having to depend on each other.
I would suggest you to follow DRY and move those functions to common library place.
to use with Namespace see
Zend Framework calling another Controller Action
hope this will sure help you.
Upvotes: 1