Welcome Guest, Not a member yet? Register   Sign In
css, js, img in view don't work
#1

(This post was last modified: 04-01-2018, 08:15 AM by cvlancvlan.)

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
Reply
#2

You need to place your assets folder in the root along with index.php
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply
#3

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 ?>
Reply
#4

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
E-surf
Reply
#5

i know use assets but i need this structure

application
- views
-- template
--- admin
---- css
----- style.css
---- js
---- img
--- default
---- css
----- style.css
---- js
---- img
Reply
#6

You can change the view folder in index.php to point to your own view folder.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB