tasarimbey adlı üyeden alıntı: mesajı görüntüle
hata nedir hocam ?, klasör yapısını ve kod yapısını paylaşabilrmisiniz.
CONTROLLER


class Todo extends CI_Controller{
public function __construct()
{
parent::__construct();
$this->load->model("todo_model");
}
public function index(){
$items = $this->todo_model->get_all();
$viewData = array(
"todos" => $items,
);
$this->load->view("todo_list", $viewData);
}
public function insert(){
$todo_title = $this->input->post("todo_title");
$insert = $this->todo_model->insert(
array(
"title" => $todo_title,
"isCompleted" => 0,
"createdAt" => date("Y-m-d H:i:s")
)
);
if($insert){
redirect(base_url());
}
}
public function delete($id){
// echo $this->uri->segment(3);
$delete = $this->todo_model->delete($id);
redirect(base_url());
}
public function isCompletedSetter($id){
$completed = ($this->input->post("completed") == "true") ? 1 : 0;
$this->todo_model->update($id, array(
"isCompleted" => $completed
));
}
}





VİEW ANASAYFA AŞAĞIDA




<!doctype html>
<html lang="tr">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>TODO List</title>
<?php $this->load->view("dependencies/style"); ?>
</head>
<body>
<div class="container">
<h3 class="text-center">TODO List</h3>
<div class="row">
<div class="col-md-12">
<form action="<?php echo base_url("todo/insert"); ?>" method="post">
<div class="row">
<div class="form-group col-md-11">
<input type="text" class="form-control" name="todo_title">
</div>
<div class="col-md-1">
<button class="btn btn-primary">Kaydet</button>
</div>
</div>
</form>
</div>
</div>
<div class="row">
<div class="col-md-12">
<table class="table table-bordered table-hover table-striped">
<thead>
<th class="text-center">Açıklama</th>
<th class="text-center">Durum</th>
<th class="text-center">Sil</th>
</thead>
<tbody>
<?php foreach ($todos as $todo) { ?>
<tr>
<td class="text-left">
<?php echo $todo->title; ?>
</td>
<td class="text-center" style="width: 100px;">
<input
type="checkbox"
data-url="<?php echo base_url("todo/iscompletedsetter/$todo->id"); ?>"
class="js-switch" <?php echo ($todo->isCompleted) ? "checked" : ""; ?> />
</td>
<td class="text-center" style="width:100px;">
<a href="<?php echo base_url("todo/delete/$todo->id"); ?>" class="btn btn-danger">Sil</a>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
<?php $this->load->view("dependencies/scripts"); ?>
</body>
</html>




STİL SAYFASI AŞAĞIDADIR.


<link rel="stylesheet" href="<?php echo base_url("assets/css/bootstrap.min.css"); ?>">
<link rel="stylesheet" href="assets/css/switchery.min.css" />