2010-09-19 57 views
0

我有全新安裝的CakePHP 1.3.4 Stable。我創建了一個非常簡單的應用程序,我試圖讓它使用主題目錄視圖和佈局,而不是默認的。CakePHP,似乎無法獲得應用的主題

\應用\控制器\ 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() "; 
    } 
} 

\應用\視圖\佈局\ default.thtml中

<?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> 

\應用\視圖\測試\索引。 ctp

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

\程序\意見\主題\ RGR \ \佈局default.thtml中

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

\程序\意見\主題\ RGR \測試\ index.ctp

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

我有閱讀themes section of the 1.3 manual,以及關於這個問題的幾個ther posts但我還沒弄明白。目前放出來是

輸出

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

我期望看到

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

我想它的一個簡單的錯誤,因爲似乎沒有被其他人使用相同的問題。我已經關閉了core.php中的捕獲。

對此提出建議?

回答

2

您錯過了var $view = 'Theme'在controller.That是必要的。

+0

我知道這將是一個簡單的錯誤,謝謝 – 2010-09-20 04:12:46

相關問題