gpt4 book ai didi

javascript - 如何在Codeigniter(最新版本) View 中使用fancybox

转载 作者:行者123 更新时间:2023-12-03 07:33:07 26 4
gpt4 key购买 nike

我想在我的 CodeIgniter View 之一中使用 fancybox。首先,我下载了 fancybox,然后解压缩并将文件复制到 CodeIgniter 的 application/third_party 文件夹中。然后在 myView.php 中我这样做了:

 <script type="text/javascript" src="<?php echo base_url('third_party/fancyBox/lib/jquery.mousewheel-3.0.6.pack.js'); ?>"></script>

但是当我使用 Firefox(Inspect Element)查看所有请求时,我收到 404 错误(mousewheel-3.0.6.pack.js)。我有什么错吗?我应该遵循哪种方法?

更新:

这是我现在正在尝试的 View 部分:

<!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>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.0/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link rel="stylesheet" src="http://fancyapps.com/fancybox/source/jquery.fancybox.css"></script>
<script src="http://fancyapps.com/fancybox/source/jquery.fancybox.js"></script>
<script type="text/javascript" src="<?php echo base_url('/Fancybox/lib/jquery.mousewheel-3.0.6.pack.js'); ?>"></script>

<title>Private Area</title>
<link rel="stylesheet" href="<?php echo base_url('home_view_style.css');?>">
</head>
<body>
<h4>Benvenuto Utente</h4>
<a href="home/logout">Logout</a>
<a class="fancybox" data-fancybox-type="iframe" rel="group" href="http://www.istruzioneformazionelavoro.it/Engine/RAServeFile.php/f/corsi/84/Tabella_corsi_allegatoDD311.pdf">prova</a>

最佳答案

不要将其放在应用程序文件夹中,创建文件夹,其中包含您的index.php,例如 Assets ,在那里提取精美的框,然后在 View 中写入类似 <script src="/asssets/fancyBox/lib/jquery.mousewheel-3.0.6.pack.js"></script> 的内容

啊哈,方法 - 你可以在你的 webroot 所在的位置提取 codeigniter 文件,这很好,但是正如用户指南所说,你可以创建 public 文件夹并将你的 index.php 放在那里,将你的域设置为指向此文件夹并调整应用程序和index.php 中的系统路径。这样,您的文件在公众视线之外就安全了。

通过观看其他人的工作来学习。我看了一下github,最近的CI项目,在那里你可以清楚地看到目录结构,其中 Assets 是https://github.com/PandaGG/CI_Blog ,index.php 文件位于 public 目录中。

关于javascript - 如何在Codeigniter(最新版本) View 中使用fancybox,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35731953/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com