Basic Code Igniter Controller


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <?php
  2. class Snippets extends Controller {
  3.  
  4. function Snippets()
  5. {
  6. parent::Controller();
  7. $this->load->model('Snippet');
  8.  
  9. }
  10.  
  11. function index()
  12. {
  13. $data["query"] = $this->db->get('snippets');
  14.  
  15. $data['title'] = 'My page title';
  16. $data['footer'] = "Copyright: Matt Stopa 2010";
  17.  
  18. $partials = array('contents'=>'snippetsview');
  19.  
  20. $headers = Array("Language", "Name", "Description");
  21. $this->table_display->set_headers($headers);
  22. $this->table_display->set_query($data["query"]->result());
  23. $this->table_display->set_display_order(Array("language", "name", "description"));
  24. $this->table_display->set_alternate_row_color(TRUE, array("rowone", "rowtwo"));
  25. $this->table_display->set_links(array("description" => array("index.php/snippets/mah/", "index")));
  26.  
  27. $this->template->load('template', $partials, $data);
  28.  
  29. //$this->template->load('template', 'about');
  30. }
  31.  
  32. function mah () {
  33. }
  34.  
  35.  
  36. }
  37. ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.