Skip to Content
PHPCODE
Codeigniter Adding CSS JS files
codeigniter code / July 28, 2018

Adding CSS JS files in Codeigniter

Step 1 :Codeigniter created folder assets and css and folder and js

step 2 :css load Three type of Codeigniter

Note :Static
(1)<link rel=”stylesheet” type=”text/css” href=”http://localhost/codeigniter/assets/css/bootstrap.min.css”>

(2)<link rel=”stylesheet” type=”text/css” href=”<?= base_url(‘assets/css/bootstrap.min.css’);?>”>
Note :base_url used helper load do it

for example $this->load->helper(‘url’);

(3)<?= link_tag(‘assets/css/bootstrap.min.css’);?>
Note :link_tag used to html helper load do it

For Example :-$this->load->helper(‘html’);

step 3 :- js load this
(1) <script src=”https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js”></script>
(2) <script src=”<?= base_url(‘assets/js/bootstrap.min.js’);?>”></script>

PHPCODE © 2024