codeigniter_tutorial
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
22. Adding JS and CSS<br />
CodeIgniter<br />
Adding JavaScript and CSS (Cascading Style Sheet) file in CodeIgniter is very simple.<br />
You have to create JS and CSS folder in root directory and copy all the .js files in JS<br />
folder and .css files in CSS folder as shown in the figure.<br />
For example, let us assume, you have created one JavaScript file sample.js and one<br />
CSS file style.css. Now, to add these files into your views, load URL helper in your<br />
controller as shown below.<br />
$this->load->helper('url');<br />
After loading the URL helper in controller, simply add the below given lines in the view<br />
file, to load the sample.js and style.css file in the view as shown below.<br />