I search in yii portal, but i can’t find how to make a script to count view with MySql every time to view post add +1 to views and then reach count etc. 41.82 it should to be display 41.82K for shorter number
Sorry but im new in in yii and i try to learn about this
public function actionView($id)
{
$model=$this->loadModel($id);
if (($count=Yii::app()->getGlobalState($model->title))==null)
Yii::app()->setGlobalState($model->title,1);
else Yii::app()->setGlobalState($model->title,++$count);
$this->render('view',array('model'=>$model));
}
In view something like this.
div style="float:right;color:green;">
<?php echo Yii::app()->getGlobalState($model->title).' view(s)';?>
</div>