CodeIgniter Forums
css, js, img in view don't work - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5)
+--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24)
+--- Thread: css, js, img in view don't work (/showthread.php?tid=70372)



css, js, img in view don't work - cvlancvlan - 04-01-2018

I have this structure but can't acces (css, js, img) files
Code:
<?php echo base_url('application/views/admin/css/style.css'); //don't work ?>
<?php echo base_url('application/views/default/css/style.css'); //don't work ?>

application
 - views
  -- template
   --- admin
    ---- css
     ----- style.css
    ---- js
    ---- img
  --- default
   ---- css
    ----- style.css
   ---- js
   ---- img

i have this .htaccess

RewriteEngine On
#RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) index.php/$1 [L]

Now i remove htaccess from application but is not a good solution


RE: css, js, img in view don't work - InsiteFX - 04-02-2018

You need to place your assets folder in the root along with index.php


RE: css, js, img in view don't work - msz900 - 04-02-2018

You need to place your assets folder outside the application folder like:

your project folder
     application
     assets
     etc....


the access the files like:


PHP Code:
<?php echo base_url('asstes/css/style.css'); 


OR


PHP Code:
<?php echo base_url()assets/css/style.css ?>



RE: css, js, img in view don't work - Kennyendowed - 04-03-2018

What your doing is wrong You need to place your assets folder outside the application folder and not inside it should be like:

This below
application
assets
etc....


the access the files Not the way you are doing it now


RE: css, js, img in view don't work - cvlancvlan - 04-08-2018

i know use assets but i need this structure

application
- views
-- template
--- admin
---- css
----- style.css
---- js
---- img
--- default
---- css
----- style.css
---- js
---- img


RE: css, js, img in view don't work - InsiteFX - 04-08-2018

You can change the view folder in index.php to point to your own view folder.