Sitansu
Sitansu

Reputation: 891

How to access a plugins component function in app/controller using Cakephp

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?

Upvotes: 0

Views: 2512

Answers (2)

brownpl
brownpl

Reputation: 73

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.

Upvotes: 1

KoU_warch
KoU_warch

Reputation: 2150

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

Upvotes: 0

Related Questions