要加載在codeignitor外部JavaScript文件不加載,我使用外部JS和CSS在笨
<script src="<?php echo base_url("application/js/contentslider.js"); ?>" type="text/javascript"></script>
我可以在頁面的源看到的
<script src="http://localhost/cinifb_ci/application/js/contentslider.js" type="text/javascript"></script>
,這意味着我的知識該文件加載完全類似於我的CSS文件,我已經使用
<link rel="stylesheet" href="<?php echo base_url(); ?>application/css/default.css" type="text/css" />
並在頁面的源代碼中顯示爲
<link rel="stylesheet" href="http://localhost/cinifb_ci/application/css/default.css" type="text/css" />
這意味着即使其加載完美。 (點擊源代碼中的外部js/css鏈接,顯示403 Forbidden
)。但是他們的效果都不適用於頁面。沒有錯誤顯示。 我已經加載URL幫手控制器$this->load->helper('url');
,並放置在$autoload['helper'] = array('url');
autoload.php
可以請你解釋一下我哪裏出了錯。
我知道要加載外部JS,我們需要安裝jquery-codeigniter庫。我已經下載了它們,並將相應的文件包含到我的應用程序文件夾的相應文件夾中。
現在,當我嘗試包括在我的控制器$this->load->library('jquery');
,其顯示
An Error Was Encountered
Unable to load the requested class: jquery
因此,我請你,請幫助我理解爲什麼403禁止顯示了當我看到它指向的確切位置JS/CSS文件,其次,如果jquery-codeigniter庫的安裝錯誤,請指導我。
注:http://ellislab.com/codeigniter/user-guide/libraries/javascript.html沒有幫助我
編輯:
jQuery的笨庫我已經放在system/libraries/javascript/
在系統中的.htaccess文件,我已經寫爲
RewriteEngine on
RewriteRule ^$ /index.php [L]
RewriteCond $1 !^(index\.php|images|css|js|video_files|robots\.txt|favicon\.ico)
RewriteRule ^(.*)$ /cinifb_ci/index.php/$1 [L]
在視圖中我寫作
$this->load->helper('url');
<script src="<?php echo base_url("application/js/jquery-1.8.2.js"); ?>" type="text/javascript"></script>
在控制器
$this->load->helper('url');
$this->load->library('javascript');
$this->load->library('javascript/jquery');
$this->load->library('Jquery_ext');
,如果我再次看它的源指向正確的信號源,但仍然如果我點擊外部JS文件鏈接,其顯示403 Forbidden
錯誤
對不起冗長的職位:(
建議請。 。!
る改名
sample
包括jQuery的文件header – 2013-03-22 12:03:53@DesertP當然,我已經將它們包含在頭本身 – 2013-03-22 12:12:48
中,因爲我沒有得到很好的答覆,因爲我給出了活動源URL的那一天,當然現在它工作:) – 2013-03-23 07:55:36