Guest User

Untitled

a guest
May 20th, 2018
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. <?php
  2. defined('BASEPATH') OR exit('No direct script access allowed');
  3.  
  4. class Beritasekolah extends CI_Controller {
  5.  
  6. function __construct(){
  7. parent:: __construct();
  8. $this-> load->model('m_beritasekolah');
  9. }
  10. public function index()
  11. {
  12.  
  13. $data['beritasekolah'] = $this-> m_beritasekolah-> list_beritasekolah();
  14. $this-> template-> load('static','beritasekolah',$data);
  15.  
  16. }
  17. public function readmore()
  18. {
  19. $id = $this-> uri-> segment(3);
  20. $data['beritasekolah'] = $this-> m_beritasekolah-> list_beritasekolah_single($id);
  21. $this-> template-> load('static','readmore1',$data);
  22. }
  23. }`
  24.  
  25. <?php
  26. defined('BASEPATH') OR exit('No direct script access allowed');
  27.  
  28. class M_beritasekolah extends CI_Model {
  29.  
  30. public function list_beritasekolah()
  31. {
  32. $beritasekolah = $this-> db-> query('SELECT * FROM beritasekolah;');
  33. return $beritasekolah;
  34. }
  35. public function list_beritasekolah_single($id){
  36. $single = $this-> db-> select('*')
  37. -> from('beritasekolah')
  38. -> where('id_beritasekolah',$id)
  39. -> get();
  40. return $single;
  41. }
  42.  
  43. <?php }?>
  44. <?php echo $this->pagination->create_links(); ?>
  45.  
  46. </div>`
  47. </div>
  48. </div>
  49. </div>`
Add Comment
Please, Sign In to add comment