How can i use plugins theme for errormessages in cakephp?

73 views Asked by At

I have a shop system running with CakePHP 2.2.

Now i want to write a "plugin" for resellers, with its own theme and using its own url. It works fine, when i request existing pages, but when request a page, which its view or controller is missing, the error is rendered with the default shopping theme, not with "reseller-plugin-theme". But i dont want my customers see the "default" shop.

How can i use a plugin specific error layout? Is there a way to force a error theme in MyPluginAppController.php?

M. :)

Sry, i will try to explain my problem better:

i have a customer store e.g. customerstore.com its themed (app/View/Themed/Default/etc...)

now i want to integrate a reseller store e.g. resellerstore.com

my routes.php

$plugin = false;
if (!stristr($_SERVER['SERVER_NAME'],'customerstore.com')) {
    if(stristr($_SERVER['SERVER_NAME'],'resellerstore.com'))
        $plugin = 'reseller';
}
Router::connect('/', array('plugin' => $plugin, 'controller' => 'pages', 'action' => 'display', 'home'));

My ResellerAppController.php

class ResellerAppController extends AppController {
    public $theme = 'Reseller';

}

it works fine with reseller-theme until i have a missing view or controller or another error. this error message is using the theme of customerstore.com. i want to make my app in case of any error viewing resellerstore.com to display the theme of resellerstore.com and not customerstore.com

thx :)

1

There are 1 answers

0
may saghira On

For forcing to use an other layout , in the controller :

public function errorView() {
    // some code
    $this->layout = 'error_layout';
}

in a the view :

$this->layout = 'error_layout';