0

I want to call a function of a component present in plugin. In my app/xyz_controller i include it as follows var $components = array('Plugin_name.Component_name'); And i call a function as- $this->Component_name->xyz(); But it doesnot work. Can any body help me where is the problem?

2 Answers 2

1

Not sure if this was just your example, but you should refer to plugins and components using camel case instead of underscores:

$components = array('PluginName.ComponentName'); 
$this->ComponentName->xyz();

This seems to work for me - I am running using Cake 1.3.

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

1 Comment

Way better than the other answer :)
0

Have you tried requestAction?, perhaps you could use something like

$this->requestAction('/Plugin_name/Component_name/xyz');

you can get more information about requestAction at the online documentation

requestAction - CakePHP Manual

3 Comments

He isn't trying to load an action. He is trying to call a component function. RequestAction won't do that for him.
interesting, i came with that after reading link wich actually calls a function inside the plugin controller using requestAction. Why it wont work in this case?
because requestAction can call controller actions but not call controller's component functions. That is the difference.

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.