user1097734
user1097734

Reputation: 183

CakePHP - Accessing a Controller Action after setting up a shared core

I have setup a shared CakePHP environment by copying the contents of the app folder to each specific web application which point to the CakePHP core files (see code below).

if (!defined('ROOT')) {
    define('ROOT', 'C:'.DS.'xampp'.DS.'htdocs'.DS.'mywebsite');
}

if (!defined('APP_DIR')) {
    define('APP_DIR', '');
}

if(!defined('CAKE_CORE_INCLUDE_PATH')){
    define('CAKE_CORE_INCLUDE_PATH', 'C:'.DS.'xampp'.DS.'htdocs'.DS.'cakephp'.DS.'lib');
}

When I first created the application (using the default route settings and correct db config), no problems are reported. However, when I start creating the structure, I have the following problem when trying to access an action of a controller: 'C:\xampp\htdocs\mywebsite\View\Users\index.ctp'. As you can see, an extra directory separator has been added to the beginning of the View directory. The ROOT constant echo's out 'C:\xampp\htdocs\mywebsite'. I can't see how and where to remove this extra separator.

Please can somebody state how?

Thanks in advance.

Upvotes: 0

Views: 120

Answers (1)

Dave
Dave

Reputation: 29131

Move the 'mywebsite' to the 'APP_DIR' constant:

if (!defined('ROOT')) {
    define('ROOT', 'C:'.DS.'xampp'.DS.'htdocs');
}

if (!defined('APP_DIR')) {
    define('APP_DIR', 'mywebsite');
}

Upvotes: 1

Related Questions