Membuat Judul Dan Body Dinamis
url seperti berikut ...
http://localhost:8080/Citutorial2/index.php/welcome/page1
view/page.php
<!Doctype html>
<html>
<head>
<title><?php echo $judul?></title>
</head>
<body>
<h1><?php echo $body?></h1>
</body>
</html>
Controller/welcome.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Welcome extends CI_Controller {
public function index()
{
$data['judul']="index";
$this->load->view('welcome_message',$data);
}
public function page1(){
$data['judul']="Page1";
$data['body']="This is Body 1";
$this->load->view('page',$data);
}
public function page2(){
$data['judul']="page 2";
$data['body']="This is Body 2";
$this->load->view('page',$data);
}
}
http://localhost:8080/Citutorial2/index.php/welcome/page1
view/page.php
<!Doctype html>
<html>
<head>
<title><?php echo $judul?></title>
</head>
<body>
<h1><?php echo $body?></h1>
</body>
</html>
Controller/welcome.php
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Welcome extends CI_Controller {
public function index()
{
$data['judul']="index";
$this->load->view('welcome_message',$data);
}
public function page1(){
$data['judul']="Page1";
$data['body']="This is Body 1";
$this->load->view('page',$data);
}
public function page2(){
$data['judul']="page 2";
$data['body']="This is Body 2";
$this->load->view('page',$data);
}
}
view/welcome_message.php
<title><?php echo $judul?></title>
Membuat Judul Dan Body Dinamis
Reviewed by Leo
on
11:39
Rating:
No comments