Perkenalan kepada CodeIgniter

2,696 views

Published on

Penjelasan singkat mengenai codeigniter bagi pemula

Published in: Technology
1 Comment
2 Likes
Statistics
Notes
No Downloads
Views
Total views
2,696
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
225
Comments
1
Likes
2
Embeds 0
No embeds

No notes for slide




































  • Perkenalan kepada CodeIgniter

    1. 1. Introduction to CodeIgniter Andri Yudatama
    2. 2. What is CodeIgniter?
    3. 3. CodeIgniter adalah sebuah open source PHP framework dengan pendekatan MVC (Model-View-Controller)
    4. 4. MVC adalah sebuah arsitektur pemrograman yang memisahkan fungsi logic, pengolahan data, dan tampilan/kosmetik
    5. 5. MVC Application Flow Controller Browser Model Database View
    6. 6. MVC Application Flow Controller Browser Model Database View
    7. 7. MVC Application Flow Controller Browser Model Database View
    8. 8. MVC Application Flow Controller Browser Model Database View
    9. 9. MVC Application Flow Controller Browser Model Database View
    10. 10. MVC Application Flow Controller Browser Model Database View
    11. 11. MVC Application Flow Controller Browser Model Database View
    12. 12. MVC Application Flow Controller Browser Model Database View
    13. 13. ? Why use framework?
    14. 14. ?
    15. 15. ? Development lebih cepat
    16. 16. ? Development lebih cepat Keseragaman coding
    17. 17. ? Development lebih cepat Keseragaman coding Reuseable codes
    18. 18. Let’s go DEEPER
    19. 19. www.codeigniter.com
    20. 20. - [ system ] - [ application ] + [ config ] + [ controller ] + [ errors ] + [ helpers ] + [ hooks ] + [ language ] + [ libraries ] + [ models ] + [ views ] + [ cache ] + [ codeigniter ] + [ database ] + [ fonts ] + [ ... ] + [ user_guide ] + index.php + license.txt File Structure
    21. 21. - [ system ] - [ application ] + [ config ] + [ controller ] + [ errors ] + [ helpers ] + [ hooks ] + [ language ] + [ libraries ] + [ models ] + [ views ] + [ cache ] + [ codeigniter ] + [ database ] + [ fonts ] + [ ... ] + [ user_guide ] + index.php + license.txt File Structure
    22. 22. URI Structure http://example.com/index.php/page/about_us/ Controller Method
    23. 23. Model Sebuah class yang di dalamnya terdapat beberapa fungsi PHP yang biasanya digunakan untuk koneksi ke database dan memanipulasi data (CRUD)
    24. 24. <?php class M_karyawan extends Model { function M_karyawan() { parent::Model(); } function get_karyawan() { $query = $this->db->get(‘tabel_karyawan’, 10, 0); if($query->num_rows() > 0) { return $query->result(); } else { return false; } } } Model (system/application/models/m_karyawan.php)
    25. 25. <?php class M_karyawan extends Model { function M_karyawan() { parent::Model(); } function get_karyawan() { $query = $this->db->get(‘tabel_karyawan’, 10, 0); if($query->num_rows() > 0) { return $query->result(); } else { return false; } } } Model (system/application/models/m_karyawan.php)
    26. 26. <?php class M_karyawan extends Model { function M_karyawan() { parent::Model(); } function get_karyawan() { $query = $this->db->get(‘tabel_karyawan’, 10, 0); if($query->num_rows() > 0) { return $query->result(); } else { return false; } } } Model (system/application/models/m_karyawan.php)
    27. 27. Controller Sebuah class yang di dalamnya terdapat beberapa fungsi PHP yang berfungsi sebagai logic untuk mengatur bagaimana aplikasi bekerja
    28. 28. <?php class Karyawan extends Controller { function Karyawan() { parent::Controller(); } function get_karyawan() { $this->load->model(‘m_karyawan’); $data[‘karyawan’] = $this->m_karyawan->get_karyawan(); $this->load->view(‘karyawan_view’, $data); } } Controller (system/application/controllers/karyawan.php)
    29. 29. <?php class Karyawan extends Controller { function Karyawan() { parent::Controller(); } function get_karyawan() { $this->load->model(‘m_karyawan’); $data[‘karyawan’] = $this->m_karyawan->get_karyawan(); $this->load->view(‘karyawan_view’, $data); } } Controller (system/application/controllers/karyawan.php)
    30. 30. <?php class Karyawan extends Controller { function Karyawan() { parent::Controller(); } function get_karyawan() { $this->load->model(‘m_karyawan’); $data[‘karyawan’] = $this->m_karyawan->get_karyawan(); $this->load->view(‘karyawan_view’, $data); } } Controller (system/application/controllers/karyawan.php)
    31. 31. View Sebuah file yang menampilkan informasi ke browser Biasanya berupa HTML/CSS/JS dengan beberapa kode PHP
    32. 32. <!-- html, head, body tag --> <table> <tr> <td>Nama</td> <td>No Telp</td> </tr> <?php foreach($karyawan as $k): ?> <tr> <td><?php echo $k->nama;?></td> <td><?php echo $k->no_telp;?></td> </tr> <?php endforeach; ?> </table> <!-- /body, /html tag --> View (system/application/views/karyawan_view.php)
    33. 33. <!-- html, head, body tag --> <table> <tr> <td>Nama</td> <td>No Telp</td> </tr> <?php foreach($karyawan as $k): ?> <tr> <td><?php echo $k->nama;?></td> <td><?php echo $k->no_telp;?></td> </tr> <?php endforeach; ?> </table> <!-- /body, /html tag --> View (system/application/views/karyawan_view.php)
    34. 34. <!-- html, head, body tag --> <table> <tr> <td>Nama</td> <td>No Telp</td> </tr> <?php foreach($karyawan as $k): ?> <tr> <td><?php echo $k->nama;?></td> <td><?php echo $k->no_telp;?></td> </tr> <?php endforeach; ?> </table> <!-- /body, /html tag --> View (system/application/views/karyawan_view.php)
    35. 35. Video Tutorial Hello World!
    36. 36. Video Tutorial #1 - Hello world!
    37. 37. Resources http://www.codeigniter.com http://www.codeigniter.com/user_guide http://www.nettuts.com http://www.smashingmagazine.com http://www.designfellow.com/ (cheat sheet)
    38. 38. Questions?

    ×