1
votes

I have a plugin and inside the plugin I have a Lib folder. Like this:

Lib/Billing/CMS/CMS.php

How can I use the CMS class inside CMS.php on my controller? Not my plugin controller, but a controller on my application.

EDIT: Cake version is 2.3

1
You should always mention the cakephp version you are using.mark

1 Answers

1
votes

So, from your short information one can only guess... Your plugin is "Billing"?

Your files are

APP/Plugin/Billing/Lib/CMS/CMS.php (class CMS)
APP/Plugin/Billing/Lib/Billing.php (class Billing)

You include classes always the same, using App::uses(). Then its

App::uses('CMS', 'Billing.CMS'); // Filename, Plugin.Package

and

App::uses('Billing', 'Billing.Lib'); // Lib as package namespace here due to lack of a proper one

I do not have to point out, that you need to load your plugin first, right? Using CakePlugin::load()/loadAll()