Membuat Body Dinamis

Controller/welcome.php


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

class Welcome extends CI_Controller {

public function index()
{
$data['content']="welcome_message";
$this->load->view('site',$data);
}
public function site1(){
$data['content']="page1";
$this->load->view('site',$data);
}
public function site2(){
$data['content']="page/page2";
$this->load->view('site',$data);
}
}


View/Site.php

<?php $this->load->view($content);?>


View/welcome_message
http://localhost:8080/Citutorial5/index.php/welcome/index

//sudah disediakan oleh codeigniternya sendiri

View/page1.php
http://localhost:8080/Citutorial5/index.php/welcome/site1

<!Doctype Html>
<html>
<head>
<title>H1</title>
</head>
<body>
<h1>This Is page 1</h1>
</body>
</html>

View/page/page2.php
http://localhost:8080/Citutorial5/index.php/welcome/site2

<!Doctype Html>
<html>
<head>
<title>H1</title>
</head>
<body>
<h1>This Is page 2</h1>
</body>
</html>





Membuat Body Dinamis Membuat Body Dinamis Reviewed by Leo on 22:40 Rating: 5

No comments