2

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

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

1 Comment

@user2794741,glad to help you,.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.