Question

I'm creating a CMS in Cakephp. What I would like to do is to create 1 core project with al the basic controllers/models/views/...

Then I would like to create per website a projectfolder. That connects to the core project for its database/models/controllers and views. So that when I change something in the core project. It changed in all websites.

My folder structure is like this: - www - core (core project of the basic CMS) - Controller - Model - ... - lib (cakephp folder) - example.com (folder of the website project that uses the core CMS - Controller (extends controller from core project) - Model (same as controller) - ...

In the bootstrap of the example.com project I tried the following for my controllers:

App::build(array(
    'Controller' => array(
        ROOT.'core'.DS.'Controller'.DS,  
        APP.'Controller'.DS
    )
));

Then I called the pagescontroller:

App::uses('AppController', 'Controller');

class AppPagesController extends PagesController {

    function index(){
        echo 'test';
        exit;
    }
}

But I get the following errors: Fatal error: Class 'PagesController' not found in /www/liwebbe/Controller/PagesController.php on line 4

So he doesn't find the Pagescontroller from my core project.

Is there anyone who could help me. Google doens't find any related problems.

Thanks in advance.

Kind regards.

Was it helpful?

Solution

That's because you're importing AppController, not PagesController

Try changing:

App::uses('AppController', 'Controller'); 

for:

App::uses('PagesController', 'Controller');
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top