Reputation: 751
I’m new using codeigniter. I using codeigniter 2.X. I have some question regarding basic course of codeigniter.
site url/css
<?php echo base_url(); ?>
but how in css and javascript?Both question, I need for the best and experience answer because the answer will be my knowledge base for using codeigniter.
Thank you so much.
Upvotes: 2
Views: 235
Reputation: 7055
Store your css/js/image in assets folder or as u want
/www
/code_igniter
/application
/assets
+img
+css
+js
/controllers
/system
then use it in your view as including it
<link type="text/css" rel="stylesheet" href='<?php echo base_url()?>assets/css/mystyle.css'>
<script type="text/javascript" src='<?php echo base_url()?>assets/js/myjs.js'></script>
into your .htacess
file add this code
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
put .htaccess
file outside the application folder
Upvotes: 1