在Phalcon中覆盖布局 [英] Override layout in Phalcon

查看:94
本文介绍了在Phalcon中覆盖布局的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经找到了如何借助以下方法在Phalcon中进行视图覆盖: https://stackoverflow.com/a /19941928/74651

I have found out how to do a view override in Phalcon with the help of this: https://stackoverflow.com/a/19941928/74651

问题是它使用此方法进行布局,但是如果目录在原始视图路径上不存在,则确实会使用此方法输入.

The problem is that it uses this method for the layout to, but if the directory does not exists on the original viewpath it does enter in this method.

phalcon在哪里检查目录的布局以及如何覆盖它?

Where does phalcon checks the directory for the layout and how to override it?

推荐答案

这里此处.

因此,您可以做三件事.首先,更改布局目录,其次,仅设置布局,或第三,同时更改:)

So, you could do three things. First, change the layout dir, second, just set the layout, or third, change both :)

$view->setLayoutsDir('custom/layouts/');
$view->setLayout('outrageouslyCustomLayout');

请参见文档中的所有方法.如果我没记错的话,路径必须是相对于您的views目录的.

See all methods in the documentation. If I remember correctly, paths must be relative to your views directory.

标准视图提供了许多控制渲染的方法,这可能是您实际上不需要覆盖某些东西–

Standard view offers quite a few ways of controlling your rendering, it might be that you don't really need to override things – http://docs.phalconphp.com/en/latest/reference/views.html#control-rendering-levels

这篇关于在Phalcon中覆盖布局的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆