tags:

views:

343

answers:

1

I cannot set title_for_layout on the default PagesController that comes by default with cakephp 1.3.

I am using the following code on the display function:

$this->set('title_for_layout','some title');

What am I doing wrong ???

+2  A: 

In your controller, the corresponding value is $this->pageTitle.

UPDATE

Oops, as noted in the comments, this is the 1.2 solution. 1.3 possibilities (after doing some research) include:

  1. Ensuring that $title_for_layout is being echoed in the layout
  2. Placing the $this->set() code in the view rather than in the controller
Rob Wilkerson
As an addition: you can also set this value in the corresponding View which would be even more MVC
harpax
Sorry guys but $this->PageTitle is for cakephp 1.2 and not for 1.3 in my knowledge. In any case when used in cakephp 1.2 produces an error.
ion
Apologies. I missed the 1.3 specification in your question if that wasn't part of an edit. It does look like that's gone away in 1.3 (http://book.cakephp.org/view/1561/Migrating-from-CakePHP-1-2-to-1-3). I haven't used 1.3 yet, but a read of the docs indicates that what you're doing should work if the rest of the context is correct.
Rob Wilkerson
At the risk of stating the obvious, are you echoing the `$title_for_layout` variable in your actual layout? e.g. `<title><?php echo $title_for_layout; ?></title>`?
Rob Wilkerson
Looks like the solution was to put the $this->set() code in the view and not in the controller.
ion