Reputation: 269
i cant load my css and js in the view file i already added them in the folder and already set my base url these code however is working with a project i did on a lower version of codeigniter . what seems to be wrong? my view:
<link href="<?php echo base_url()?>js/dataTables/dataTables.bootstrap.css" rel="stylesheet" />
</br></br>
<div class="panel panel-primary" style=" width: 1050px; border-radius: 0">
<div class="panel-heading" style="border-radius: 0 ">user List <button data-toggle="tooltip" data-placement="bottom" title="Print Customer Order" style="border-radius: 0px;"type="button" class="btn btn-default" aria-label="Left Align">
<a href="<?php echo base_url() . 'admin/printlist/'; ?>">
Print List
</a>
</button> </div>
<div class="panel-body" style="border-radius: 0 ">
<table id="myTable" class="table table-bordered" >
<thead>
<tr>
<th>Surname</th>
<th>Name </th>
<th>Age</th>
<th>School</th>
<th>Course</th>
<th>Email</th>
</tr>
</thead>
<tbody>
<?php foreach ($user as $users): ?>
<tr>
<td><?php echo $users->surname; ?></td>
<td><?php echo $users->name; ?></td>
<td><?php echo $users->age; ?></td>
<td><?php echo $users->school; ?></td>
<td><?php echo $users->course; ?></td>
<td><?php echo $users->email; ?></td>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<script src="<?php echo base_url() ?>js/dataTables/jquery.dataTables.js"></script>
<script src="<?php echo base_url() ?>js/dataTables/dataTables.bootstrap.js"></script>
<script>
$(document).ready(function() {
$('#myTable').dataTable({
"aaSorting": [[0, "asc"]]
});
});
</script>
Upvotes: 0
Views: 696
Reputation: 106
I think there is a mistake
Replace <?php echo base_url()?>
to <?php echo base_url(); ?>
Upvotes: 0
Reputation: 175
Put CSS and JS folder in your project folder root(Application level).
I have created 'assets' folder in my project and put css and js folder in it. It's working fine.
assets/js/jquery.bootstrap-touchspin.js">Upvotes: 2
Reputation: 2469
I have done some research and i found that the default location for css files is the same level as the application in Codigniter. I.E:
/css
/application
Check this first if that's your case. You can fix this with some simple ../
in front of the echo.
Another thing I noticed is, your CSS file is located in a js folder (js/dataTables/
)? Maybe this is a fast copy/paste fault?
Upvotes: 2