Advertisement
Guest User

Untitled

a guest
Apr 24th, 2014
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. $criteria = new CDbCriteria;
  2. $total = Recipe::model()->count();
  3.  
  4. $pages = new CPagination($total);
  5. $pages->pageSize = 10;
  6. $pages->applyLimit($criteria);
  7.  
  8. $posts = Recipe::model()->findAll($criteria);
  9.  
  10. $this->render('index', array(
  11. 'posts' => $posts,
  12. 'pages' => $pages,
  13. ));
  14.  
  15. <div id="posts">
  16. <?php foreach($posts as $rec): ?>
  17.  
  18. <?php $rec_id=$rec['recipe_id']; $name=$rec['name']; ?>
  19. <?php echo $name=$rec['name']; ?>
  20.  
  21. if(isset($_GET['Model_page'])){
  22. if($model->search()->pagination->pageCount < $_GET['Model_page']+1){
  23. throw new CHttpException(404,'No More results');
  24. }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement