I am doing a project in Yii framework now. i am concern about title tag and other meta tag which will be dynamic as well for SEO propose , The data for the tags will be fetched from database and displayed in the front-end.
/**
* @var string meta tag keywords content
*/
public $keywords = '';
/**
* @var string meta tag description content
*/
public $description = '';
/**
* This method is invoked at the beginning of {@link render()}.
* @param string $view the view to be rendered
* @return boolean whether the view should be rendered.
*/
protected function beforeRender($view)
{
list($keyword, $description) = Yii::app()->seoHelper->findMetaTags();
$this->keywords = $keyword ? $keyword : Yii::app()->settings->get('meta', 'keywords');
$this->description = $description ? $description : Yii::app()->settings->get('meta', 'description');
return parent::beforeRender($view);
}
For title there’s a yii pageTitle. You may overwrite [size=“2”]getPageTitle() with your own implementation.[/size]