Wednesday, November 25, 2015

yii how to use og meta tag for facebook share


 Yii::app()->clientScript->registerMetaTag(Yii::app()->name,null,null,array('property'=>'og:site_name'));
 Yii::app()->clientScript->registerMetaTag($this->createAbsoluteUrl('video/details',array('id'=>$video->id, 'slug'=>$video->slug)),null,null,array('property'=>'og:url'));
 Yii::app()->clientScript->registerMetaTag($video->tittle,null,null,array('property'=>'og:title'));
 Yii::app()->clientScript->registerMetaTag($video->details,null,null,array('property'=>'og:description'));
 Yii::app()->clientScript->registerMetaTag("movie",null,null,array('property'=>'og:type'));
              if($video->screensort):
 $path_image = YiiBase::getPathOfAlias('webroot').'/upload/'.$video->screensort;
 $cropimg= Yii::app()->easyImage->thumbSrcOf($path_image, array('crop' => array('width' => 270, 'height' => 150)));
 Yii::app()->clientScript->registerMetaTag($cropimg,null,null,array('property'=>'og:image'));
 Yii::app()->clientScript->registerMetaTag("270",null,null,array('property'=>'og:image:width'));
 Yii::app()->clientScript->registerMetaTag("150",null,null,array('property'=>'og:image:height'));
              
  endif;


No comments:

Post a Comment