23. Views Should be placed under “application/views/index.php” <html> <title> My First CodeIgniter Project</title> <body> <h1>Welcome to My CodeIgniter</h1> </body> </html>
24. Views Calling a VIEW from Controller $this->load->view(‘index’); Data Passing to a VIEW from Controller function index() { $data = array( ‘ full_name’ => ‘appleboy’, ‘ email’ => ‘appleboy.tw@gmail.com’ ); $this->load->view(‘index’, $data); }
26. Models Models Should be placed Under “application/models/” class News_model extends Model { function Mlb_model() { parent::Model(); } function get_news ($id) { $this->db->select(‘news_id, news_name'); $this->db->from('project_news'); $query = $this->db->get(); return $query->result_array(); } }