A php error was encountered severity

controller/home.php

<?php

class Home extends CI_Controller
{
    function construct()
    {
        parent::_construct();
        $this->load->model(['ModelBuku','ModelUser','ModelBooking']);
    }

    public function index()
    {
        $data = [
            'judul' => "Katalog Buku",
            'buku' => $this->ModelBuku->getBuku()->result(),
        ];

        //jika  sudah  login  dan  jika  belum  login
        if  ($this->session->userdata('email'))  {
            $user = $this->ModelUser->cekData(['email'=> $this->session->userdata('email')])->row_array();

            $data['user'] = $user['nama'];

            $this->load->view('templates/templates-user/header', $data);
            $this->load->view('buku/daftarbuku', $data);
            $this->load->view('templates/templates-user/modal');
            $this->load->view('templates/templates-user/footer', $data);
        }else{
            $data['user'] = 'Pengunjung';
            $this->load->view('templates/templates-user/header', $data);
            $this->load->view('buku/daftarbuku', $data);
            $this->load->view('templates/templates-user/modal');
            $this->load->view('templates/templates-user/footer', $data);
        }
    }
    public function detailBuku()
    {
        $id = $this->uri->segment(3);
        $buku = $this->ModelBuku->joinKategoriBuku(['buku.id' =>$id])->result();


        $data['user']  =  "Pengunjung";
        $data['title']  =  "Detail  Buku";

        foreach ($buku as $fields){
            $data['judul'] = $fields->judul_buku;
            $data['pengarang'] = $fields->pengarang;
            $data['penerbit'] = $fields->penerbit;
            $data['kategori'] = $fields->kategori;
            $data['tahun'] = $fields->tahun_terbit;
            $data['isbn'] = $fields->isbn;
            $data['gambar'] = $fields->image;
            $data['dipinjam'] = $fields->dipinjam;
            $data['dibooking'] = $fields->dibooking;
            $data['stok'] = $fields->stok;
            $data['id'] = $id;
        }

        $this->load->view('templates/templates-user/header', $data);
        $this->load->view('buku/detail-buku', $data);
        $this->load->view('templates/templates-user/modal');
        $this->load->view('templates/templates-user/footer');
    }

}

view/templates/templates-user/header.php

<!DOCTYPE  html>
<html lang="en">

<head>
<meta  charset="UTF-8">
<meta  name="viewport"  content="width=device-width,  initial-scale=1.0">
<meta  http-equiv="X-UA-Compatible"  content="ie=edge">
<title>Pustaka-Booking |<?=  $judul;  ?></title>
<link  rel="icon" type="image/png" href="<?= base_url('assets/img/logo/'); ?>logo-pb.png">
<link  rel="stylesheet" href="<?= base_url('assets/'); ?>user/css/bootstrap.css">

<link href="<?= base_url('assets/'); ?>vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
<link href="<?= base_url('assets/'); ?>datatable/datatables.css" rel="stylesh eet" type="text/css">
    <!-- Custom styles for this template-->
    <link href="<?= base_url('assets/'); ?>css/sb-admin-2.min.css" rel="stylesheet">
    <link href="https://fontawesome.com/v3.2.1/assets/font-awesome/css/font-awesome.css" rel="stylesheet">
</head>
<body>
<nav class="navbar  navbar-expand-lg  navbar-light  bg-light">
<div class="container">
    <a class="navbar-brand" href="<?= base_url(); ?>">Pustaka</a>
    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
    </button>

    <div class="collapse  navbar-collapse" id="navbarNavAltMarkup">
        <div class="navbar-nav">
        <a class="nav-item nav-link active" href="<?= base_url(); ?>">Beranda<span class="sr-only">(current)</span></a>
        <?php
        if (!empty($this->session->userdata('email')))  {  ?>
        <a class="nav-item nav-link" href="<?= base_url('booking'); ?>">Booking <b>
        <?= $this->ModelBooking->getDataWhere('temp', ['email_user' => $this->session->userdata('email')])->num_rows(); ?></b> Buku</a>
        <a class="nav-item nav-link" href="<?= base_url('member/myprofil'); ?>">Profil Saya</a>
        <a class="nav-item nav-link" href="<?= base_url('member/logout'); ?>"><i class="fas fw fa-login"></i>Log out</a>
        <?php } else { ?>
        <a class="nav-item nav-link" data-toggle="modal" data-target="#daftarModal" href="#"><i class="fas fw fa-login"></i>Daftar</a>
        <a class="nav-item nav-link" data-toggle="modal" data-target="#loginModal" href="#"><i class="fas fw fa-login"></i>Log in</a>
        <?php } ?>
        <span class="nav-item nav-link nav-right" style="display:block; margin-left:20px;">Selamat Datang<b><?= $user; ?></b></span>
        </div>
    </div>
</div>
</nav>
<div  class="container  mt-5">

A PHP Error was encountered Severity: Notice

Message: Undefined property: CI_Loader::$ModelBooking

Filename: templates-user/header.php

Line Number: 32

Backtrace:

File: C:\xampp\htdocs\pustaka-booking99\application\views\templates\templates-user\header.php Line: 32 Function: _error_handler

File: C:\xampp\htdocs\pustaka-booking99\application\controllers\home.php Line: 24 Function: view

File: C:\xampp\htdocs\pustaka-booking99\index.php Line: 315 Function: require_once

avatar Loa2nd
@Loa2nd

2 Kontribusi 0 Poin

Dipost 4 tahun yang lalu

Belum ada Jawaban. Jadi yang pertama Jawaban

Login untuk ikut Jawaban