开发者

CakePHP, Can't seem to get a theme to apply

I have a fresh install of CakePHP 1.3.4 Stable. I created a very simple application and i am trying to get it to use the theme dire开发者_如何学Cctory view and layout instead of the default.

\app\controllers\tests_controller.php

<?php
class TestsController extends AppController {
    var $name = 'Tests';
    var $uses = array();
    var $theme = 'rgr';


    function index() {
        $this->theme = 'rgr';
        $this->layout = 'default';

        echo "Controler = TestsController::index() ";
    }
}

\app\views\layouts\default.ctp

<?php echo $html->docType(); ?>
<html xmlns="http://www.w3.org/1999/xhtml">
    <head></head>
    <body>
        Layout = No theme 
        <?php echo $content_for_layout; ?>  
    </body>
</html>

\app\views\tests\index.ctp

<div class="test index">
    test index, no theme
</div>

\app\views\themed\rgr\layouts\default.ctp

<?php echo $html->docType(); ?>
<html xmlns="http://www.w3.org/1999/xhtml">
    <head></head>
    <body>
         Layout = RGR
        <?php echo $content_for_layout; ?>  
    </body>
</html>

\app\views\themed\rgr\tests\index.ctp

<div class="test index">
    View=test index, RGR theme
</div>

I have read the themes section of the 1.3 manual, and a few other posts on the subject But I have yet to figure it out. Currently the out put is

Output

Controler = TestsController::index() Layout = No theme
test index, no theme, v2

I expected to see

Controler = TestsController::index() Layout = RGR
View=test index, RGR theme

I'm thinking its a simple mistake as there does not seem to be anyone else with the same problem. I have turned off catching in the core.php.

Suggestions?


You missed var $view = 'Theme' in the controller.That's necessary.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜