CakePHP,似乎无法应用主题

发布于 2024-09-24 06:05:41 字数 1970 浏览 2 评论 0原文

我全新安装了 CakePHP 1.3.4 Stable。我创建了一个非常简单的应用程序,我试图让它使用主题目录视图和布局而不是默认的。

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

< strong>\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>

我已阅读 1.3 手册的主题部分,以及一些有关该主题的其他帖子 但我还没有弄清楚。目前输出是

输出

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

我希望看到

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

我认为这是一个简单的错误,因为似乎没有其他人遇到同样的问题。我已经关闭了 core.php 中的捕获。

建议?

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

眼眸里的那抹悲凉 2024-10-01 06:05:41

您在控制器中错过了 var $view = 'Theme'。这是必要的。

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文