为什么CSS和JS没有加载?

I have googled and tried many solutions which worked for others but not in my case. I don't know why.

Background:

I am learning to use CodeIgniter 2.2.0. I have set up project structure and all the things as below, but still I am not able to load my CSS and JS.

View Code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
   <head id="Head1">
      <title>   </title>
      <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
      <!-- solution 1 I have tried: -->
      <!-- in below line I tried by using constant set in constants.php file under application/config/ folder --> 
      <link rel="stylesheet" href="<?php echo (CSS.'dialog.css' );?>" type="text/css">
      <!-- solution 2 I have tried: -->
      <!-- As my css n script files are under CodeIgniter_2.2.0/assets/css and CodeIgniter_2.2.0/assets/scripts folder respectively -->
      <link rel="stylesheet" href="/assets/css/dialog.css" type="text/css">
      <!-- solution 3 I have tried -->
      <!-- This I tried by using autoload.php settings where I am setting autoload['helper'] = array('url'); -->
      <?php echo link_tag('assets/css/dailog.css');?> </br>
      <script src="../../script/Plugins/jquery.js" type="text/javascript"></script> 
   </head>
</html>

Config:

Also I have set

$config['base_url'] = "http://localhost/"; in application/config/config.php file.

Project Folder Structure:

My project folder structure is as follows :

enter image description here

(Application , System, Assets folders are at same level)

The contents of .htaccess file are :

(.htaccess file path : C:\xampp\htdocs.htaccess )

RewriteEngine on

RewriteCond $1 !^(index\.php|images|js|css|robots\.txt)

RewriteRule ^(.*)$ /index.php/$1 [L]

there are 2 more .htaccess file at C:\xampp\htdocs\CodeIgniter_2.2.0\System and C:\xampp\htdocs\CodeIgniter_2.2.0\application folder both have single line written :

Deny from all

Also, at C:\xampp\htdocs\, there is a file index.php which is same as the index.php file placed at C:\xampp\htdocs\CodeIgniter_2.2.0\ in which I have set following things

$system_path = 'CodeIgniter_2.2.0/system';
$application_folder = 'CodeIgniter_2.2.0/application';

Is there anything that I am missing in this? I am not able to load any CSS or JS files on my page.

查看全部
dougu2006
dougu2006
2014/10/16 17:28
  • css
  • codeigniter
  • php
  • javascript
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

1个回复