Yii Framework Forum: how to change title and meta tags dynamically? - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

how to change title and meta tags dynamically? Rate Topic: -----

#1 User is offline   boetchax 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 8
  • Joined: 22-September 09

Posted 11 January 2010 - 04:41 AM

hi all,

how to change title and meta tags dynamically?

thx
0

#2 User is offline   Horacio Segura 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 535
  • Joined: 11-August 09
  • Location:Argentina

Posted 11 January 2010 - 05:33 AM

View Postboetchax, on 11 January 2010 - 04:41 AM, said:

hi all,

how to change title and meta tags dynamically?

thx


I do not know if what you want, but you can use http://www.yiiframew...iiBase#t-detail
for change the views dynamically

or you can define your own "t" and using a database

I hope is what you want
KISS - Keep It Simple Stupid
ASAP-As Soon As Possible
http://www.yiiframew...oc/cookbook/71/
http://hmsegura.blogspot.com/
0

#3 User is offline   andy_s 

  • Random Member Title
  • Yii
  • Group: Moderators
  • Posts: 1,526
  • Joined: 22-June 09
  • Location:Russia, Kostroma

Posted 11 January 2010 - 05:52 AM

View Postboetchax, on 11 January 2010 - 04:41 AM, said:

hi all,

how to change title and meta tags dynamically?

thx


If you want to set a page title and meta tags in a controller's action, then use the following syntax:

public function actionMyAction()
{
    $this->pageTitle = 'New Title';

    Yii::app()->clientScript->registerMetaTag('foo, bar', 'keywords');
}


More about the registerMetaTag() method: http://www.yiiframew...rMetaTag-detail
0

#4 User is offline   m_s 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 11-February 12
  • Location:United Kingdom

Posted 13 February 2012 - 03:57 PM

Nice and elegant tip - thanks very much for that!

View Postandy_s, on 11 January 2010 - 05:52 AM, said:

If you want to set a page title and meta tags in a controller's action, then use the following syntax:

public function actionMyAction()
{
    $this->pageTitle = 'New Title';

    Yii::app()->clientScript->registerMetaTag('foo, bar', 'keywords');
}


More about the registerMetaTag() method: http://www.yiiframew...rMetaTag-detail

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

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