• 11-07-2022, 14:36:20
    #1
    Üyeliği durduruldu
    Arkadaşlar codeigniter 3 kullanıyorum. URL ile ilgili base url , autoload url, ve view sayfalarına <base href="<?php echo base_url() ?>"/> koydum. Fakat yönlendirmeleri bir türlü gerçekleştiremiyorum, stilleri yükleyemiyorum. Nerede ahta yapmış olabilirim. CI4'ü hiç anlamadım kaynak fazla diye 3 öğreneyim dedim işn içinden çıkamadım.
  • 11-07-2022, 14:37:20
    #2
    hata nedir hocam ?, klasör yapısını ve kod yapısını paylaşabilrmisiniz.
  • 11-07-2022, 14:41:45
    #3
    Üyeliği durduruldu
    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" />
  • 11-07-2022, 14:42:34
    #4
    AeAziz adlı üyeden alıntı: mesajı görüntüle
    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" />
    klasör yapısını da atarmısınız ve config base url
  • 11-07-2022, 15:03:49
    #5
    Üyeliği durduruldu
    tasarimbey adlı üyeden alıntı: mesajı görüntüle
    klasör yapısını da atarmısınız ve config base url
    https://github.com/gkandemi/codeigniter-simple-todo.git


    Bir youtuber'in videosunda ki klasör dizini. Birebir aldım koydum çalışmadı.
  • 11-07-2022, 15:06:14
    #6
    AeAziz adlı üyeden alıntı: mesajı görüntüle
    https://github.com/gkandemi/codeigniter-simple-todo.git


    Bir youtuber'in videosunda ki klasör dizini. Birebir aldım koydum çalışmadı.
    base urli değiştirdiğinize emin misiniz? localde https yok ona da dikkat ediniz
  • 11-07-2022, 15:17:45
    #7
    Üyeliği durduruldu
    tasarimbey adlı üyeden alıntı: mesajı görüntüle
    base urli değiştirdiğinize emin misiniz? localde https yok ona da dikkat ediniz
    elimde iki kaynak kod var ikisi de eğitmenlerin dosyası. ikisinide denedim olmuyor. onlarda bütün ayarlar tamam. siz indirip çalıştırdınız mı, çok küçük bir dosya zaten.
  • 11-07-2022, 15:20:01
    #8
    AeAziz adlı üyeden alıntı: mesajı görüntüle
    elimde iki kaynak kod var ikisi de eğitmenlerin dosyası. ikisinide denedim olmuyor. onlarda bütün ayarlar tamam. siz indirip çalıştırdınız mı, çok küçük bir dosya zaten.
    Kuruluma gerek yok ki. Kodlara baktım bir sorun görünmüyor
  • 11-07-2022, 15:29:39
    #9
    Üyeliği durduruldu
    Neyse xampp yerine appserv firefox yerine chrome filan deneyecem. Teşekkürler.