要加载在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