0

How can I use Namespaces and USE function in magento 1.9 ? I dont want to use require or include function just set one namespaces and use this in my controller like laravel or magento 2. Is it possible in magento 1.9.

2
  • You want to use namespace of what ? please explain exactly what you want to do
    – PЯINCƎ
    Jul 27, 2017 at 7:53
  • For example : Assume I have create one php file and set namespace for this file and I want to use this file without using php require and include method I want to use this file in another file with USE function like we are using in laravel. Hope you got my point. Jul 27, 2017 at 9:05

1 Answer 1

0

You can do this with _forward() method like this:

$this->_forward($action = 'methodName', $controller = 'controller_name', $module = 'Modulename', $params = array('id'=>$id))

But it's not a best way and a good practice, I suggest you to create your function in a helper and call this function from a helper to the both controllers !

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.