tags:

views:

24

answers:

1

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 directory 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"&gt;
    <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"&gt;
    <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?

+1  A: 

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

SpawnCxy
I knew it was going to be a simple mistake, thank you
Steven smethurst