Zakaria Sichaib
Zakaria Sichaib

Reputation: 137

Can't Load asset files codeigniter

I've spent the last 7 hours trying to load my assets folder to my view file but for some reason it didn't work ! i read the docs , stackoverflow posts & tried everything but nothing seems to be working.

here's my folder structures:

htdocs
 CRM 
   app-assets
     css
        pages
          dashboard-ecommerce.css
        bootstrap.css
        bootstrap-extended.css
     vendors
        css
          vendors.min.css
          charts
            apexcharts.css
          extensions
            swiper.min.css  
  Applications
     controllers
       dashboard.php
     views
       dashboard.php
  assets
  (+ the rest of the files with .htaccess included)

Now here's the dashboard's header part:

    <!-- BEGIN: Vendor CSS-->
    <link rel="stylesheet" type="text/css" href="app-assets/vendors/css/vendors.min.css">
    <link rel="stylesheet" type="text/css" href="app-assets/vendors/css/charts/apexcharts.css">
    <link rel="stylesheet" type="text/css" href="app-assets/vendors/css/extensions/swiper.min.css">
    <!-- END: Vendor CSS-->

    <!-- BEGIN: Theme CSS-->
    <link rel="stylesheet" type="text/css" href="app-assets/css/bootstrap.css">
    <link rel="stylesheet" type="text/css" href="app-assets/css/bootstrap-extended.css">


    <!-- BEGIN: Page CSS-->

    <link rel="stylesheet" type="text/css" href="app-assets/css/pages/dashboard-ecommerce.css">
    <!-- END: Page CSS-->

Note that i did change the config file to

$config['base_url'] = 'http://localhost/CRM' 

but nothing worked.

Upvotes: 1

Views: 674

Answers (1)

umefarooq
umefarooq

Reputation: 4574

Here is simple solution for this problem

<link rel="stylesheet" type="text/css" href="<?=base_url('app-assets/vendors/css/vendors.min.css')?>">
<link rel="stylesheet" type="text/css" href="<?=base_url('app-assets/vendors/css/charts/apexcharts.css')?>">
<link rel="stylesheet" type="text/css" href="<?=base_url('app-assets/vendors/css/extensions/swiper.min.css')?>">

base_url will proper base URL to the asset path.

Upvotes: 1

Related Questions