タイトル、メタ情報をアクション内で動的に変更
1.タイトル変更
$this->getResponse()->setTitle('タイトル');
[実行時の表示] <meta name="title" content="タイトル" /> <title>タイトル</title>
2.メタ情報変更
$this->getResponse()->addMeta('keywords', 'キー1,キー2');
$this->getResponse()->addMeta('description', 'ああああ,いいい');
[実行時の表示] <meta name="keywords" content="キー1,キー2" /> <meta name="description" content="あああ,いいい" />
上記コーディングにより、
アクションが実行されたときに情報が上書きされます。
ページを離れるとまた元に戻ります。
[symfony 1.0.9]