Presentasi sedang didownload. Silahkan tunggu

Presentasi sedang didownload. Silahkan tunggu

P EMROGRAMAN W EB II Lasmedi afuan, ST.,M.Cs. T OPIC CI URL Controller View.

Presentasi serupa


Presentasi berjudul: "P EMROGRAMAN W EB II Lasmedi afuan, ST.,M.Cs. T OPIC CI URL Controller View."— Transcript presentasi:

1 P EMROGRAMAN W EB II Lasmedi afuan, ST.,M.Cs

2 T OPIC CI URL Controller View

3

4 CI (C ODE I GNITER ) CodeIgniter is an Application Development Framework - a toolkit - for people who build web sites using PHP. Its goal is to enable you to develop projects much faster than you could if you were writing code from scratch, by providing a rich set of libraries for commonly needed tasks, as well as a simple interface and logical structure to access these libraries. CodeIgniter lets you creatively focus on your project by minimizing the amount of code needed for a given task.

5 C ODE I GNITER URL URL pada CI didesain lebih user friendly “URLs in CodeIgniter are designed to be search- engine and human friendly” CI menggunakan pendekatan url berbasis segment example.com/ news / article /my_article class method Id atau variabel yang akan dilewatkan melalui controller

6 URL S UFFIX Menambahkan url suffix example.com/index.php/products/view/shoes Menjadi example.com/index.php/products/view/shoes.html File yang harus dimodifikasi config/config.php Dengan url suffix, dapat menambahkan ekstensi sesuai dengan keiinginan.

7 C ONTROLLER Controller di CI berfungsi sebagai intermediary yang menghubungkan antara model dengan view.

8 M Y F IRST C ONTROLLER <?php Class Blog extends CI_Controller { public function index() { echo “this is my first controller”; } ?>

9 CO NTROLLER Lokasi penyimpanan controller C:\xampp\CI_FOLDER\Application\controllers

10 N AMA KELAS Valid Tidak valid

11 E XTENDS Digunakan untuk melalukan inherit dari class CI_Controller

12 S ELALU INGAT INI

13 N EXT C ONTROLLER <?php Class Blog extends CI_Controller { public function index() { echo "this is my first controller"; } public function myprofil() { echo "this is my profile"; } ?>

14 M ENGAKSES HALAMAN MYPROFIL Localhost/CI213/index.php/Blog/myprofil

15 M ELEWATKAN VARIABEL UNTUK DITAMPILKAN MELALUI CONTROLLER <?php Class Blog extends CI_Controller { public funtion tampil($nim,$nama) { echo “$nim $nama”; } ?>

16 <?php Class Blog extends CI_Controller { public function index() { echo "this is my first controller"; } public function myprofil() { echo "this is my profile"; } public function tampil($nim,$nama) { echo “$nim $nama”; } ?>

17 C LASS CONSTRUCTOR Jika ingin menggunakan controller parent Parent::__construct();

18 R ESERVED N AMES Controller Name Controller CI_Base _ci_initialize Default index

19 R ESERVED N AMES Functions is_really_writable() load_class() get_config() config_item() show_error() show_404() log_message() _exception_handler() get_instance()

20 Variables $config $mimes $lang

21 V IEW Menampilkan halaman web ( webpage) ke user. (ci_view.php) Belajar CI CI ku yang pertama

22 L OADING V IEW Ingat !! Controller digunakan untuk menjembatani antara model dan view

23 L OADING V IEW $this->load->view(‘ view name ');

24 <?php Class Blogview extends CI_Controller { public function index() { $this->load->view(‘ci_view’); } ?>

25 L OADING MULTIPLE VIEW <?php Class Blogview extends CI_Controller { public function index() { $this->load->view(‘header’); $this->load->view(‘kiri’); $this->load->view(‘kanan’); $this->load->view(‘footer’); } ?>


Download ppt "P EMROGRAMAN W EB II Lasmedi afuan, ST.,M.Cs. T OPIC CI URL Controller View."

Presentasi serupa


Iklan oleh Google