CakePHP 2.0.0-dev中的主题

CakePHP 2.0.0-dev中的主题,cakephp,themes,cakephp-1.3,cakephp-2.0,Cakephp,Themes,Cakephp 1.3,Cakephp 2.0,正在尝试在CakePHP2.0.0-dev中设置移动主题,但它没有像在1.3中那样工作。2.0中的主题实现是否有任何更改 结构如下: app/views/themed/mobile/layouts/default.ctp app/views/themed/mobile/pages/home.ctp 然后在app/app_controller.php中: public function beforeRender() { if ($this->RequestHandler->i

正在尝试在CakePHP2.0.0-dev中设置移动主题,但它没有像在1.3中那样工作。2.0中的主题实现是否有任何更改

结构如下:

app/views/themed/mobile/layouts/default.ctp
app/views/themed/mobile/pages/home.ctp
然后在app/app_controller.php中:

public function beforeRender()
{
    if ($this->RequestHandler->isMobile()) {
        $this->view = 'Theme';
        $this->theme = 'mobile';
    }
}
点击主页。。。但是没有移动站点。。。只是正常的网站。没有错误,调试或错误日志中没有任何内容。没有错误,没有例外。没有什么。就好像主题已经被弃用了一样

任何人有什么想法吗?

试试:

$this->layout='mobile';
当移动设备浏览到时,应该会显示布局。

已解决

在查看了cake/libs/view/theme.php之后,我读到以下内容:

…您可以设置
$this->theme
$this->viewClass='theme'

因此,在2.0版中,变量名从$this->view$this->viewClass似乎有了细微的变化


现在工作

如果有人对此有进一步的问题,我在

上发布了一篇文章,其中有更多信息,您需要创建自己的布局,称为“移动”(或其他任何您喜欢的布局)
public function beforeRender()
{
    if ($this->RequestHandler->isMobile()) {
        $this->viewClass = 'Theme';
        $this->theme = 'mobile';
    }
}