简体   繁体   English

CakePHP title_for_layout

[英]CakePHP title_for_layout

I have this function: 我有这个功能:

function view ( $id )
{
    $this->layout = 'page';

    $this->User->id = $id;

    $this->set('title_for_layout', $username);

    $this->set('users', $this->User->read());
}

What I want to do is show the username as the title but the current code I have doesn't do this... how do I do it? 我想做的是显示用户名作为标题,但是我当前拥有的代码没有这样做...我该怎么做?

$this->User->id = $id;
$this->set('title_for_layout', $this->User->field('username'));
function view ( $id )
{
$this->layout = 'page';

$this->User->id = $id;

$this->set('title_for_layout',  $this->User->field('username'));

$this->set('users', $this->User->read());
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM