Yii Framework Forum: Page Title For Static Pages - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Page Title For Static Pages Rate Topic: -----

#1 User is offline   renathy 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 82
  • Joined: 05-July 11

Posted 07 December 2012 - 10:43 AM

Hi!
Is there a good way to change static page titles?
I am using CViewAction for static pages, but all of those pages has the same page title.
I want different titles for different static pages.

Thank you.
0

#2 User is offline   redguy 

  • Master Member
  • PipPipPipPip
  • Yii
  • Group: Members
  • Posts: 820
  • Joined: 02-July 10
  • Location:Central Poland

Posted 07 December 2012 - 11:26 AM

by default CViewAction renders static pages as PHP ('renderAsText' switch). If you haven't changed this switch you can add plain php code to your static views. this code can be something like this:
<?php
Yii::app()->name = 'this static page name';
//or
Yii::app()->controller->title = 'xxxx';
?>


then you can use this information in layout to render page title.
red
1

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users