I’m too newbie on Yii apps and need some help. First of all, sorry for my bad english.
After following the yii blog tutorial I tried to make it better with some new features. One of them it’s stand out some news (the most recent). I want to show on top stand out news and after that all news. To do that I have to render two views on index and create two $dataProviders (these two views use the same model Post but have particular $criteria, pagination, etc). When i call renderPartial and render functions it works but seems that something breaks and all the accent marks are shown as part of code.
That’s my actionIndex:
public function actionIndex()
{
$criteriaPost=new CDbCriteria(array(
'condition'=>'status='.Post::STATUS_PUBLICADO,
'order'=>'update_time DESC',
'with'=>'commentCount',
));
if(isset($_GET['tag']))
$criteria->addSearchCondition('tags',$_GET['tag']);
$dataProviderPost=new CActiveDataProvider('Post', array(
'pagination'=>array(
'pageSize'=>5,
),
'criteria'=>$criteriaPost,
));
$criteriaDestacados=new CDbCriteria(array(
'condition'=>'status='.Post::STATUS_PUBLICADO,
'order'=>'update_time DESC',
'with'=>'commentCount',
'offset' => 0,
'limit'=>6,
));
if(isset($_GET['tag']))
$criteria->addSearchCondition('tags',$_GET['tag']);
$dataProviderDestacados=new CActiveDataProvider('Post', array(
'pagination' => false,
'criteria'=>$criteriaDestacados,
));
$this->pageTitle = "SVGA - Noticias"; // It could be something from DB or...whatever
$this->renderPartial('destacados',array(
'dataProvider1'=>$dataProviderDestacados,
));
$this->render('index',array(
'dataProvider2'=>$dataProviderPost,
));
}
Index:
<?php $this->widget('zii.widgets.CListView', array(
'dataProvider'=>$dataProvider2,
'itemView'=>'_view',
'sortableAttributes'=>array(
'title',
'create_time'=>'Fecha',
),
));
?>
Destacados(outstanding):
<?php $this->widget('zii.widgets.CListView', array(
'dataProvider'=>$dataProvider1,
'summaryText'=>'',
'itemView'=>'_destacadosview',
));
?>
Somebody know what’s wrong?