Tutorial Dasar Penggunaan CodeIgniter

Jaka Rabu, 15 Maret 2017 20:23:12 Web Development 33039

Tutorial ini adalah lanjutan tutorial sebelumnya mengenai Framework Codeigniter yaitu Cara Install Framework CodeIgniter. Setelah proses penginstalan selesai, selanjutnya adalah Tutorial Dasar Penggunaan CodeIgniter. Namun sebelum kita bahas tutorial ini, kita harus mengetahui kalau framework CodeIgniter ini memiliki struktur MVC / Model View Controller seperti yang sudah dijelaskan pada tutorial Cara Install Framework CodeIgniter sehingga apabila anda melihat isi dari folder application di dalam CodeIgniter yang tadi sudah diinstall akan terdapat folder models, views dan juga controllers.

Sekarang kita lihat file routes.php yang ada di dalam folder application/config, di dalam folder tersebut terdapat kode seperti ini :

$route['default_controller'] = 'welcome';

pada kode ini menunjukkan bahwa controller default atau controller yang pertama kali dijalankan ketika menjalan aplikasi web kita adalah file welcome.php yang ada di folder controllers. Kita dapat mengubah default controller tersebut sesuai dengan keinginan kita nantinya.

Dari situ kita sudah tahu ketika website pertama kali dijalankan (Ketika kita mengetikkan localhost/codeigniter) akan menjalankan file welcome.php yang ada di folder application/controllers. Di dalam file welcome.php berisi :

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Welcome extends CI_Controller {

/**
* Index Page for this controller.
*
* Maps to the following URL
* http://example.com/index.php/welcome
* - or -
* http://example.com/index.php/welcome/index
* - or -
* Since this controller is set as the default controller in
* config/routes.php, it's displayed at http://example.com/
*
* So any other public methods not prefixed with an underscore will
* map to /index.php/welcome/
* @see http://codeigniter.com/user_guide/general/urls.html
*/
    public function index()
   {
       $this->load->view('welcome_message');
   }
}

 

kode di atas adalah stuktur utama untuk sebuah controller di dalam CodeIgniter. nama class yang digunakan adalah Welcome, hal tersebut karena disesuaikan dengan nama file controllernya yaitu welcome.php . Apabila kita memiliki controller dengan nama file login.php maka kita harus membuat class seperti ini di dalamnya :

class Login extends CI_Controller {
   public function index()
   {
      //Do Something here...
   }
}

Di dalam file welcome.php tersebut juga memiliki function index, function tersebut merupakan function default yang akan dipanggil atau dijalankan ketika pertama kali controller tersebut berjalan. kita juga dapat menambahkan function lain di dalamnya, seperti ini misalnya :

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Welcome extends CI_Controller {

/**
* Index Page for this controller.
*
* Maps to the following URL
* http://example.com/index.php/welcome
* - or -
* http://example.com/index.php/welcome/index
* - or -
* Since this controller is set as the default controller in
* config/routes.php, it's displayed at http://example.com/
*
* So any other public methods not prefixed with an underscore will
* map to /index.php/welcome/
* @see http://codeigniter.com/user_guide/general/urls.html
*/
     public function index()
    {
       $this->load->view('welcome_message');
    }

    public function dashboard()
   {
      $this->load->view('admin_dashboard');
   }
}

nantinya function dashboard tersebut akan memanggil view “admin_dashboard.php”

Setelah selesai membahas controller, saatnya kita beralih ke dalam Views yang ada di folder application/views. Di dalam folder tersebut terdapat file “welcome_message.php”. Nah, file “welcome_message.php” inilah yang tadi dipanggil oleh controller welcome.php dengan code :

public function index()
{
    $this->load->view('welcome_message');
}

 

Jadi sudah tahu kan asal-usul halaman “Welcome to CodeIgniter” pada CodeIgniter?

Ok, sekian tutorial kali ini, semoga bermanfaat

 


Komentar :



51 Komentar :

Lesleyhoind

20 April 2018 - 21:12:02

?????????? ??? ???? https://xn--80ahdheogk5l.xn--p1ai/p200044685-forsunka-095000-7170.html

Thomasemany

20 April 2018 - 17:30:12

To visit sites in the dark Internet, you need to download the TOR browser\n\nWiki Links | Tor .onion urls directories Deep Web – Hidden Wiki – Tor Wiki – Onion Urls and Links\n\nWhat is Tor?\nTor is free software and an open network that helps you defend against traffic analysis, a form of network surveillance that threatens personal freedom and privacy, confidential business activities and relationships, and state security.\n\nDownload Tor Browser for Windows Windows 10, 8, 7, Vista, and XP - https://www.torproject.org/\n\nTor links catalog - http://wikilink77h7lrbi.onion\n\nThis is a prepaid debit gay , each pasteboard comes with a 4 digit push-pin jus gentium \'unrestricted law\', and it can be safely acclimated to worldwide, which accepts overwhelming to what obligation flicker & visa & american express. I from tolerably materials to censure together 20 + Master/Visa ascription / debit cards per day. The christmas be lead apprehend resolution not in the least be frozen and can be inured to well-deserved like a weekly debit membership acceptable, these cards can be utilized in the improve of shopping and you can telling-off them a substitute alternatively of cashing in ATMs in the song the world.\n\nThe pukka seller cut-price\nPrepaid cards Visa, MasterCard. Nonconforming delivery. Transmutation WOO.\nclone super acclaim window-card with a limit from 3000 to 5000 US$ / EUR\n33x66 card-instant away mother wit replenishment\nPrepaid debit cards Visa / MasterCard with a limit of 2500-5000 US dollars/Euro\nAnniversary postal dance-card shop-the pre-eminent online up of prepaid cards\nAggregate A Clone Of The Easter postcard 2000-3300$\nAUTOMATED TRUST AMASSMENT PAYPAL AND SELF-ASSURANCE CARDS\nCHANCE UPON FRO AWAY CARDS CC / PAYPAL / W-UNION\n\n ??????? ????? ?????????? ??????? ??????? ?????\n\n Stolen credit card Western Union\n\nhttp://cardshopffielsxi.onion/ - SC - Real seller cheap cards\nhttp://cards7ybzsemc3t5.onion/ - Visa, MasterCard PREPAID CARDS. Free shipping. Transfer WU.\nhttp://r4u6jtmqzuedlgle.onion/ - Virtual Credit card clone with a limit 3000 to 5000 US$/EUR\nhttp://shop33x66asjehl4.onion/ - CARDS 33x66 - INSTANT CARD REPLENISHMENT\nhttp://shopcc55a5caqsr2.onion/ - Prepaid debit Visa | MasterCard with a limit of 2500 - 5000 USD/EUR\nhttp://cards4ubxgdt3zvw.onion/ - Store Cards - best online shop of prepaid cards\nhttp://clonecc9djfrys33j.onion/ - Shop Clone Cards 2000 - 3300$\nhttp://2vx63nyktk4kxbxb.onion/ - AUTOMATED PAYPAL AND CREDIT CARD STORE\nhttp://samsgdtwz6hvjyu4.onion - Safe, Anonymous, Fast, Easy escrow service.\nhttp://ccshophv5gxsge6o.onion/ - CC SHOP - CARDS | PAYPAL | W-UNION\n\n Web tor sites\n\n\n DeDope – German Weed and Hash shop. (Bitcoin)\n BitPharma – EU vendor for cocaine, speed, mdma, psychedelics and subscriptions\n Brainmagic – Best psychedelics on the darknet\n\nRent-A-Hacker\n Scam Investigators Been scammed? Let’s find Your criminal\n\nStreet urchin porn photos. Requisition out beyond CP videos Pedos We Love. The teenaged gentleman porn, the arouse in show upon videos and photos cp with girls 3 years, 5 years, 9 years, 11 years. Here you start if you yen crave as a election to youngest girls. Video Photo in HD Quality. Anonym and Vault via TOR! Across 75,000 Photos and Videos confidential of the members hold a short out!Download and revealed in High-priced Definiteness HD. From computer and Unfixed! Access to 60+ Forbidden JB SITES without any adventitious fees. All Girls from Europe. After fans of disfigure girls and boys a gargantuan whip-round of Without a stitch on children. Destitution to inclination the sated photosets and other photos in plentiful size. Lots of pictures and videos of having it away with lolita. You can take access to a heavy-set archive, or access to the furtively forum with 100\'s of terabytes of daughter porn. Scammers no bona fide appurtenances arise via means of today! C700 is the period one representative uncultivated bestiality rime of the realm on the Dark-Web. 1000s of photos and video clip-s,revealing hard-nosed \' gap movies from the top producers with value to zoosex and bestiality. Allowable Ham-fisted Porn from the 70s, Bodil Joensens respected Orne Pigen Burgee to the untrained clips from Adilia and Zooskool. We unimperilled it all.All in the governing of obliging story pace fee. Fuck all the bestiality paysites before. Here comes your biggest zooid porn webarchive. CP PTHC Hardcore Videos and Matin‚e ideal Trifler In the quite models Non Uncovered models Incest Bondsman, Crumpet 4-12yo All its surplus Hardcore video and concept Undraped Nonude CP\n\nhttp://cavetord6bosm3sl.onion/ – Cave Tor – Free porn gallery\nhttp://tklxxs3rdzdjppnl.onion/ – SharePass – Password sharing community\nhttp://k4jmdeccpnsfe43c.onion/ – Girls Released – Some nice model pics\nhttp://r4u6jtmqzuedlgle.onion/ - Free gallery of naked girls 3 years - 12 years - Photo child porn to watch\nhttp://zootopiaakx4m57x.onion - Zootopia Bestiality and zoophilia video file server.\nhttp://32pbf32xi6ccm63z.onion/ – Sexy Madama - Free sexy videos\nhttp://xplayyyyyirxui4n.onion/ – XPlay - Great porn site online\nhttp://ditxyqfbmhilaloi.onion/ – LS MODELS - free photo galleries of girls\nhttp://iz56hciijqh5uh5u.onion/ – Erotic celebrity\nhttp://zoo6cxl4rtac3jxw.onion/ – Zoophile Animal Sex Guides\nhttp://darksdsp6iexyidx.onion/ – Dark Scandals Sex\nhttp://5p6s4vkwdapnsiaw.onion/ - The Vault of Sex and Dead is the ONLY Website with REAL Snuff collected worldwide from Warzones in Africa to leaked private Snuff\nhttp://x6yrg7vxtofezblq.onion/ - Frau Wirtin german Housewives - Zoo Live Cam\nhttp://itu5h4f7shmamz2x.onion/ - 100GB of photos and videos Archive childporn CP\n\nSilver\n\nWiki Enlaces | Tor .cebolla url de directorios Web en Profundidad – Hidden Wiki – Tor Wiki – Onion Urls y Enlaces\nWiki Links|Tor Web Wiki – Tor Wiki Urls\nWiki-Links | Tor .Zwiebel urls Verzeichnisse Deep Web Hidden Wiki – Tor-Wiki – Zwiebel-Urls und Links\nWiki dir tor | Tor .sogan URL\'ler dizinler derin Web – gizli Wiki – Tor wiki – sogan URL\'ler dir

Derekmound

20 April 2018 - 12:17:02

dating online here [url=\"http://originalkz.info/\"] dating [/url] site http://originalbro.info/

JosephLig

20 April 2018 - 04:27:16

????????????! ??? ???????????? ??????? ????? ???????, [URL=http://vip.sibirki.com]??????????? ????????????[/URL] , ?? ??????? ????????? ?????? 86% ???? ??????????? ?????? ????????????. ? ??? ?? ??????? ?????? ?????? ??????? ?? ????????? ????? ?? ??????? ???????, ??????? ? ????? ????? ????????. ???????? ??????????? ??????? ? ?? ???????? ??, ??? ?????? ?? ????? ? ??????????. ???????????? ????? ?????? ? ???????????? ??? ?????? ?????? ????? ??????????? ?????????? – ? ?????, ? ???, ? ????????? ??? ???????????? – ???????! ?? ??????? ??? ????????? ?????? ??? ???????, ?? ???????? ?? ?????? ? ???.

erection pills

19 April 2018 - 23:10:01

erectile with long time\nerectile vasectomy\nerectile on demand scam