【问题标题】:Lithium PHP: Open view without layoutLithium PHP:没有布局的打开视图
【发布时间】:2013-05-14 01:02:56
【问题描述】:

我正在使用 PHP 框架 Lithium(又名 li3)。我希望能够在 jquery 对话框中只打开一个视图(即没有布局)。理想情况下,我希望通过对 URL 稍作修改来完成此操作,例如:

Normal path to action: http://localhost/controller/action/ 

View only path to action: http://localhost/controller/action/view_only/

这显然仍然需要使用普通的 URL 参数和 GET 请求。此外,我希望不必更改任何现有的控制器。

有人知道我是怎么做到的吗?

谢谢, 最大。

【问题讨论】:

    标签: php layout view fragment lithium


    【解决方案1】:
    // In the controller:
    
    if ($someCondition) {
        $this->_render['layout'] = false;
    }
    // ...where $someCondition is based on whatever URL modification you do
    

    【讨论】:

    • 谢谢,我最终使用了 args 参数并设置了新路由以使其也与传入 ID 兼容。
    猜你喜欢
    • 2011-09-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-10-20
    • 1970-01-01
    • 1970-01-01
    • 2015-04-24
    • 1970-01-01
    相关资源
    最近更新 更多