如何在默认的PagesController中设置title_for_layout? [英] How can I set the title_for_layout in the default PagesController?
本文介绍了如何在默认的PagesController中设置title_for_layout?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我无法在CakePHP 1.3默认提供的PagesController中设置 title_for_layout
。
I cannot set title_for_layout
in the PagesController that comes by default with CakePHP 1.3.
我正在使用显示函数中的以下代码:
I am using the following code in the display function:
$this->set('title_for_layout','some title');
我在做什么错了?
推荐答案
在您的控制器中,相应的值为 $ this-> pageTitle
。
In your controller, the corresponding value is $this->pageTitle
.
更新
糟糕,如评论中所述,这是1.2解决方案。 1.3可能性(经过研究后)包括:
Oops, as noted in the comments, this is the 1.2 solution. 1.3 possibilities (after doing some research) include:
- 确保
$ title_for_layout
为在布局中回显 - 在视图中而不是在控制器中放置
$ this-> set()
代码
- Ensuring that
$title_for_layout
is being echoed in the layout - Placing the
$this->set()
code in the view rather than in the controller
这篇关于如何在默认的PagesController中设置title_for_layout?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文