Postingan lainnya
Dropdown di codeigniter gk jalan walaupun sudah coba template orang
Tolong bantuannya, dropdown saya di codeigniter tidak berfungsi sama sekali, walaupun sudah pakai template orang lain. Udah gk tau lagi mana yang salah. Maklum pemula. ini contoh template dari orang lain.Mohon bantuannya
head.php
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">
<title><?php echo 'Brand' .": ". ucfirst($this->uri->segment(1)) ." - ". ucfirst($this->uri->segment(2)) ?></title>
<!-- Bootstrap core CSS-->
<link href="<?=base_url('vendor/bootstrap/css/bootstrap.min.css'); ?>" rel="stylesheet">
<!-- Custom fonts for this template-->
<link href="<?=base_url('vendor/fontawesome-free/css/all.min.css'); ?>" rel="stylesheet" type="text/css">
<!-- Page level plugin CSS-->
<link href="<?=base_url('vendor/datatables/dataTables.bootstrap4.css'); ?>" rel="stylesheet">
<!-- Custom styles for this template-->
<link href="<?=base_url('css/sb-admin.css'); ?>" rel="stylesheet">
</head>
navbar.php
<nav class="navbar navbar-expand navbar-dark bg-dark static-top">
<a class="navbar-brand mr-1" href="<?php echo site_url('admin') ?>"><?php echo 'Brand' ?></a>
<button class="btn btn-link btn-sm text-white order-1 order-sm-0" id="sidebarToggle" href="#">
<i class="fas fa-bars"></i>
</button>
<!-- Navbar Search -->
<form class="d-none d-md-inline-block form-inline ml-auto mr-0 mr-md-3 my-2 my-md-0">
<div class="input-group">
<input type="text" class="form-control" placeholder="Search for..." aria-label="Search" aria-describedby="basic-addon2">
<div class="input-group-append">
<button class="btn btn-primary" type="button">
<i class="fas fa-search"></i>
</button>
</div>
</div>
</form>
<!-- Navbar -->
<ul class="navbar-nav ml-auto ml-md-0">
<li class="nav-item dropdown no-arrow mx-1">
<a class="nav-link dropdown-toggle" href="#" id="alertsDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-bell fa-fw"></i>
<span class="badge badge-danger">9+</span>
</a>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="alertsDropdown">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</li>
<li class="nav-item dropdown no-arrow mx-1">
<a class="nav-link dropdown-toggle" href="#" id="messagesDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-envelope fa-fw"></i>
<span class="badge badge-danger">7</span>
</a>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="messagesDropdown">
<a class="dropdown-item" href="#">Action</a>
<a class="dropdown-item" href="#">Another action</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#">Something else here</a>
</div>
</li>
<li class="nav-item dropdown no-arrow">
<a class="nav-link dropdown-toggle" href="#" id="userDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<i class="fas fa-user-circle fa-fw"></i>
</a>
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="userDropdown">
<a class="dropdown-item" href="#">Settings</a>
<a class="dropdown-item" href="#">Activity Log</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" href="#" data-toggle="modal" data-target="#logoutModal">Logout</a>
</div>
</li>
</ul>
</nav>
js.php
<!-- Bootstrap core JavaScript-->
<script src="<?=base_url('assets/jquery/jquery.min.js'); ?>"></script>
<script src="<?=base_url('assets/bootstrap/js/bootstrap.bundle.min.js'); ?>"></script>
<!-- Core plugin JavaScript-->
<script src="<?=base_url('assets/jquery-easing/jquery.easing.min.js'); ?>"></script>
<!-- Page level plugin JavaScript-->
<script src="<?=base_url('assets/chart.js/Chart.min.js'); ?>"></script>
<script src="<?=base_url('assets/datatables/jquery.dataTables.js'); ?>"></script>
<script src="<?=base_url('assets/datatables/dataTables.bootstrap4.js'); ?>"></script>
<!-- Custom scripts for all pages-->
<script src="<?=base_url('js/sb-admin.min.js') ?>"></script>
<!-- Demo scripts for this page-->
<script src="<?=base_url('js/demo/datatables-demo.js'); ?>"></script>
<script src="<?=base_url('js/demo/chart-area-demo.js'); ?>"></script>
sidebar.php
<!-- Sidebar -->
<ul class="sidebar navbar-nav">
<li class="nav-item <?php echo $this->uri->segment(2) == '' ? 'active': '' ?>">
<a class="nav-link" href="<?php echo site_url('admin') ?>">
<i class="fas fa-fw fa-tachometer-alt"></i>
<span>Overview</span>
</a>
</li>
<li class="nav-item dropdown <?php echo $this->uri->segment(2) == 'product' ? 'active': '' ?>">
<a class="nav-link dropdown-toggle" href="#" id="pagesDropdown" role="button" data-toggle="dropdown" aria-haspopup="true"
aria-expanded="false">
<i class="fas fa-fw fa-boxes"></i>
<span>Products</span>
</a>
<div class="dropdown-menu" aria-labelledby="pagesDropdown">
<a class="dropdown-item" href="<?php echo site_url('admin/product/new') ?>">New Product</a>
<a class="dropdown-item" href="<?php echo site_url('admin/product') ?>">List Product</a>
</div>
</li>
<li class="nav-item">
<a class="nav-link" href="#">
<i class="fas fa-fw fa-users"></i>
<span>Users</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">
<i class="fas fa-fw fa-cog"></i>
<span>Settings</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">
<i class="fas fa-fw fa-globe"></i>
<span>Website</span></a>
</li>
</ul>
footer.php
<!-- Sticky Footer -->
<footer class="sticky-footer">
<div class="container my-auto">
<div class="copyright text-center my-auto">
<span>© <?=Date('Y'); ?> Brand</span>
</div>
</div>
</footer>
index.php
<!DOCTYPE html>
<html lang="en">
<head>
<?php $this->load->view("admin/_partials/head.php") ?>
</head>
<body id="page-top">
<?php $this->load->view("admin/_partials/navbar.php") ?>
<div id="wrapper">
<?php $this->load->view("admin/_partials/sidebar.php") ?>
<div id="content-wrapper">
<div class="container-fluid">
<?php $this->load->view("admin/_partials/breadcrumb.php") ?>
<!-- DataTables -->
<div class="card mb-3">
<div class="card-header">
<a href="<?php echo site_url('admin/add') ?>"><i class="fas fa-plus"></i> Add New</a>
</div>
<div class="card-body">
<div class="table-responsive">
<table class="table table-hover" id="dataTable" width="100%" cellspacing="0">
<thead>
<tr>
<th>Name</th>
<th>Price</th>
<th>Photo</th>
<th>Description</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php foreach ($products as $product): ?>
<tr>
<td width="150">
<?php echo $product->name ?>
</td>
<td>
Rp. <?php echo number_format($product->price) ?>
</td>
<td>
<img src="<?php echo base_url('upload/product/'.$product->image) ?>" width="64" />
</td>
<td class="small">
<?php echo substr($product->description, 0, 120) ?></td>
<td width="250">
<a href="<?php echo site_url('admin/edit/'.$product->product_id) ?>"
class="btn btn-small"><i class="fas fa-edit"></i> Edit</a>
<a onclick="deleteConfirm('<?php echo site_url('admin/delete/'.$product->product_id) ?>')"
href="#!" class="btn btn-small text-danger"><i class="fas fa-trash"></i> Hapus</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- /.container-fluid -->
<!-- Sticky Footer -->
<?php $this->load->view("admin/_partials/footer.php") ?>
</div>
<!-- /.content-wrapper -->
</div>
<!-- /#wrapper -->
<?php $this->load->view("admin/_partials/scrolltop.php"); ?>
<?php $this->load->view("admin/_partials/modal.php"); ?>
<?php $this->load->view("admin/_partials/js.php"); ?>
<script>
function deleteConfirm(url){
$('#btn-delete').attr('href', url);
$('#deleteModal').modal();
}
</script>
</body>
</html>
3 Jawaban:
Ini punya saya :
<pre> <link href="<?php echo base_url();?>assets/bootstrap4/css/css1.css" rel="stylesheet" type="text/css"> </pre>
<pre> <!--SIDE-BAR--> <div class="navmenu navmenu-default navmenu-fixed-left offcanvas-sm">
&lt;ul class="nav side-nav"&gt;
&lt;li&gt;
&lt;a id="dashhboard" style="" href="&lt;?php echo base_url() ;?&gt;Home" &gt;&lt;i class="lnr lnr-big lnr-home"&gt;&lt;/i&gt; DASHBOARD &lt;/a&gt;
&lt;a id="order99" style="" href="javascript:void(0)" data-toggle="collapse" data-target="#m-master1"&gt;&lt;i class="lnr lnr-big lnr-database"&gt;&lt;/i&gt; Master&lt;i class="lnr lnr-chevron-down-circle pull-right"&gt;&lt;/i&gt;&lt;/a&gt;
&lt;ul id="m-master1" class="collapse"&gt;
&lt;li&gt;
&lt;a style="color:#fad66b;" id="linkhit1" href="javascript:ReplaceContentInContainer('MainFramee1','&lt;?php echo base_url();?&gt;Profileframe')" &gt;&lt;i class="lnr lnr-small lnr-user"&gt;&lt;/i&gt; Profile&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt; </pre>
cb di "inspect" , siapa tau ada yg ngga ke reload ... css-nya
sample "inspect-network" :
<img src=' http://tukerantools.com/forum/img/inspect_network.png '>
@hadifox <img src=' https://scontent.fsub1-1.fna.fbcdn.net/v/t1.15752-9/44954318_247535446121809_3327456776487436288_n.jpg?_nc_cat=108&_nc_ht=scontent.fsub1-1.fna&oh=eb40d3f3465ca436a9d01a0a26019b60&oe=5C7E929B '>
jquery.min.js nya itu gk jalan ya?
Kalo jquery.min.js Nya , sepahaman saya cuma untuk post/get data-ke Table aja si , yaa bisa juga buat pengolahan DOM / komponen di UI secara realtime tanpa reload page.
Yg case ini sepertinya ada kesalahan manggil class bootstrap di HTML nya , klo saya lihat inspectnya sudah kepanggil bootstrap.min.css Nya ...
Tapi tolong perhatiin lagi deh :
ada :
bootstrap.min.css : ? all.min.css : ?
sb-admin.css : ini library untuk admin-template
itu ( klo bisa buang salah satu / komen aja , mau pake <pre> bootstrap.min.css </pre> atau yang ini <pre> all.min.css </pre>
si sidebar / navbar nya jadi bingung ikut yang mana ... ^_^
<pre> <nav class="navbar navbar-expand navbar-dark bg-dark static-top"> <a class="navbar-brand mr-1" href="<?php echo site_url('admin') ?>"><?php echo 'Brand' ?> </a> </pre>
Mudah2an itu jawabannya