我有一个运行CakePHP 2.2的商店系统。
现在,我想为经销商编写一个“插件”,使用其自己的主题并使用其自己的url。当我请求现有页面时,它工作正常,但是当请求其 View 或 Controller 丢失的页面时,则使用默认购物主题而不是“reseller-plugin-theme”呈现错误。但是我不希望我的客户看到“默认”商店。
如何使用特定于插件的错误布局?有没有办法在MyPluginAppController.php中强制错误主题?
M. :)
对不起,我将尝试更好地解释我的问题:
我有一个客户商店,例如customerstore.com
其主题(应用程序/ View /主题/默认/等...)
现在我想整合转销店,例如resellerstore.com
我的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'));
我的ResellerAppController.php
class ResellerAppController extends AppController {
public $theme = 'Reseller';
}
它与转销商主题很好,直到我缺少 View 或 Controller 或其他错误。此错误消息使用的是customerstore.com的主题。
如果要查看resellerstore.com以显示resellerstore.com的主题而不是customerstore.com的任何错误,我想制作我的应用程序
谢谢 :)
最佳答案
为了强制使用其他布局,请在 Controller 中:
public function errorView() {
// some code
$this->layout = 'error_layout';
}
在 View 中:
$this->layout = 'error_layout';
关于php - 我如何在cakephp中使用插件主题来显示错误消息?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25761671/