Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Css/images/javascript in codeigniter

Concerning this post, I'd like to add css,images and js to my codeigniter application. My question is after you add path to your header file href="<?php echo base_url();?>css/moorainbow.css" , where do you actually put your files, is it in system, application, view or controller? I found like 10 articles so far explaining the same procedure but no one is talking about where actual file should be kept? can anybody help me with this ? thank you

like image 287
Gandalf StormCrow Avatar asked Dec 05 '09 16:12

Gandalf StormCrow


People also ask

HOW include CSS and JS in CodeIgniter controller?

Adding JavaScript and CSS (Cascading Style Sheet) file in CodeIgniter is very simple. You have to create JS and CSS folder in root directory and copy all the . js files in JS folder and . css files in CSS folder as shown in the figure.

Where do I put images in CodeIgniter?

Folder CreationThe first folder is the destination folder that would receive the uploaded files. Next, go to the root of the CI installation and create a folder named “uploads”. Go to the view folder (located at the root of the CI installation) and create two new “view” files. Name these files file_view.

How do I link CSS to ci4?

By using link_tag() function, we can add stylesheet files i.e css files into templates. Suppose, style. css file is inside /public/css folder.

Which folder contains the public assets JS CSS image files?

The public folder contains static files such as index. html, javascript library files, images, and other assets, etc.


2 Answers

Ok, try two. Here is the answer for Codeigniter (instead of CakePHP... sorry!)

Put any public files in the root (same directory as the main index.php)

index.php
system/
images/
js/
css/

My reference: http://www.greggoforth.net/article/5

like image 166
Doug Neiner Avatar answered Sep 20 '22 21:09

Doug Neiner


Refer to this, meaning you need to put css files in the same level as system, meaning your webroot. Not inside system, not inside application etc in the web root. And read from the website rest ..

like image 28
ant Avatar answered Sep 19 '22 21:09

ant