CakePHP - How do i set the page title to an item name?

后端 未结 10 920
囚心锁ツ
囚心锁ツ 2021-01-03 02:13

OK, so I\'m trying to teach myself the CakePHP framework, and I\'m trying to knock up a simple demo app for myself.

I have the controllers, views and models all set

10条回答
  •  星月不相逢
    2021-01-03 02:31

    Ah, the none-obvious answer is as follows...

    $this->pageTitle = $this->viewVars['guitar']['Guitar']['Name'];
    

    I found this by placing the following code in the controller (was a long shot that paid off, to be honest)

    echo "
    "; print_r($this);echo "
    ";

    Thanks to all those that tried to help.

提交回复
热议问题