Mengubah Tampilan Awal CodeIgniter

Sebagai  percobaan  kita  akan  mencoba  mengubah  halaman
awal  CodeIgniter,  untuk  melihat  bagaimana  CodeIgniter  bekerja.
Siapkanlah  Text  Editor  favorit  Anda  yang  akan  digunakan  untuk
menyunting beberapa source codeyang terdapat di CodeIgniter.
Sebelum menyunting view welcome_message.php. Kita harus
mengubah $config['base_url'] yang berada di application -> config ->
config.php dari  http://www.example.com menjadi
http://localhost/pelatihanbasdat .  Hal  tersebut  dilakukan  agar  nama
domain  yang  digunakan  dapat  digunakan  di  seluruh  bagian  kode
program yang ada di CodeIgniter.
Berikut adalah langkah – langkah untuk mengubah tampilan
halaman  awal  CodeIgniter.  Buka  Text  Editor  yang  sering  Anda
gunakan. Cari  file    welcome_message.php yang terdapat di direktori
pelatihanbasdat->application->views.  Kemudian buka  file   tersebut
menggunakan  Text Editor, Kemudian Anda cari bagian  source code
seperti pada listing berikut:
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .





<div id="container">
<h1>Welcome to CodeIgniter!</h1>
<div id="body">
<p>The page you are looking at is being generated dynamically by CodeIgniter.</p>
<p>If you would like to edit this page you'll find it located at:</p>
<code>application/views/welcome_message.php</code>
<p>The corresponding controller for this page is found at:</p>
<code>application/controllers/welcome.php</code>
<p>If you are exploring CodeIgniter for the very first time, you should start by reading the <a
href="user_guide/">User Guide</a>.</p>
</div>
<p class="footer">Page rendered in <strong>{elapsed_time}</strong> seconds</p>
</div>

Gambar 2.3 Mengubah
Kode
welcome_message.php

ganti kode tersebut menjadi pada kode editor
div id="container">
<h1>Selamat Datang di Pelatihan Basis Data 2014</h1>
<div id="body">
<p>The page you are looking at is being generated dynamically by CodeIgniter.</p>
<p>If you would like to edit this page you'll find it located at:</p>
<code>application/views/welcome_message.php</code>
<p>The corresponding controller for this page is found at:</p>
<code>application/controllers/welcome.php</code>
<p>If you are exploring CodeIgniter for the very first time, you should start by reading the <a
href="user_guide/">User Guide</a>.</p>
</div>
<p class="footer">Page rendered in <strong>{elapsed_time}</strong> seconds</p>
</div>

Bagaimanakah halaman diatas muncul ? Halaman diatas muncul karena kita memanggil
sebuah  controller yang  bernama  welcome.  Controller  ini  terdapat  di  pelatihan  basdat  ->
application -> controllers -> welcome.php. Di dalam fileini welcome.phpterdapat source code
seperti berikut:
<?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/<method_name>
* @see http://codeigniter.com/user_guide/general/urls.html
*/
public function index()
{
$this->load->view('welcome_message');
}
}
/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */

Tidak ada komentar:

Posting Komentar