Page 115 - Framework Codeigniter 2
P. 115
www.koder.web.id – Kumpulan tutorial komputer
Untuk bagian controller tidak melakukan perubahan apa-apa. kita hanya menambahkan page yang
dapat dipanggil
1. <?php if (! defined('BASEPATH')) exit('No direct script access
allowed');
2.
3. class Welcome extends CI_Controller {
4.
5. function __construct()
6. {
7. parent::__construct();
8. $this->load->library('template');
9. $this->load->helper('url');
10. }
11.
12. function index()
13. {
14. $this->template->display('welcome_message');
15. }
16.
17. function page1()
18. {
19. $this->template->display('page1');
20. }
21.
22. function page2()
23. {
24. $this->template->display('page2');
25. }
26.
27. function page3()
28. {
29. $this->template->display('page3');
30. }
31.
32. function page4()
33. {
34. $this->template->display('page4');
35. }
36. }
37.
38. /* End of file welcome.php */
39. /* Location: ./application/controllers/welcome.php */
Ketika kita mengakses page 1 secara langsung maka library template akan memampilkan page
secara utuh tetapi melalui ajax hanya akan memberikan area content.
110

