CakePHP: How do I change page title from helper?

Posted by Zeta Two on Stack Overflow See other posts from Stack Overflow or by Zeta Two
Published on 2011-01-12T11:13:13Z Indexed on 2011/01/12 11:53 UTC
Read the original article Hit count: 176

Filed under:
|
|

Hello!

I'm using a helper for static pages to add a part to the title on every page. Currently I have the following code at the top of every static page:

<?php $this->set('title_for_layout', $title->output('Nyheter')); ?>

The purpose of $title->output is to append " :: MY WEB SITE NAME". This works fine, but for simplicity I would rather just call:

$title->title('Nyheter');

At the top of every page to set the title. The problem is that I can't call $this->set() from within the helper. Is there a way to something like this or am I completely on the wrong path here?

© Stack Overflow or respective owner

Related posts about php

Related posts about cakephp