Yii Framework Forum: Ado With Pagination - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Ado With Pagination

#1 Guest_ssshobhit_*

  • Group: Guests

Posted 21 March 2013 - 05:32 AM

plz help.......


public function actionIndex()
{
$model = new bm_curriculum_resource;

$sql= 'SELECT res_com.* ,bm_curriculum_books_chapters.title AS t FROM (SELECT * FROM bm_curriculum_resource res
WHERE res.status = 1 AND res.class_id = 148
UNION ALL
SELECT * FROM bm_curriculum_resource_default res_def
WHERE res_def.status = 1
)res_com
LEFT JOIN bm_curriculum_books_chapters ON bm_curriculum_books_chapters.book_id=resource_id
AND bm_curriculum_books_chapters.status=1
ORDER BY res_com.resource_type ASC , res_com.createdate';

$resources = Yii::app()->db->createCommand($sql)->queryAll();
echo $noRow= Yii::app()->db->createCommand($sql)->queryScalar();
$criteria = new CDbCriteria();
$count=bm_curriculum_resource::model()->count($criteria);
$pages=new CPagination($count);
$pages->pageSize=10;
$pages->applyLimit($criteria);
$this->render('index', array('model'=>$model,'resources'=>$resources,'pages' => $pages));
}

Pagination not working properly....in below vew page
<?php foreach($resources as $k){


some code.......
?>
<?php $this->widget('CLinkPager', array(
'pages' => $pages,
)) ?>

This post has been edited by ssshobhit: 21 March 2013 - 05:34 AM

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

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