我有一个使用codeigniter 2.1的插件可以完美的工作。我现在正在尝试使用这个插件作为动态生成的页面的一部分,该页面由几个视图组成。
为此,我的控制器包含以下内容:
$this->load->view('blue_view_widget'); // the file upload view
$this->load->view('form'); // a form我现在看到模板上载和模板下载表(由javascript生成)被表单视图中的html覆盖。我认为(可能是错误的)第二个视图的html在javascript有时间在视图底部动态生成表之前就被回显出来了。我该如何解决这个问题呢?
这是我的代码:
</script>
<!-- The template to display files available for download -->
<script id="template-download" type="text/x-tmpl">
{% for (var i=0, file; file=o.files[i]; i++) { %}
<!-- <tr class="template-download fade">-->
<tr class="template-download ">
{% if (file.error) { %}
<td></td>
<td class="name"><span>{%=file.name%}</span></td>
<td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td>
<td class="error" colspan="2"><span class="label label-important">{%=locale.fileupload.error%}</span> {%=locale.fileupload.errors[file.error] || file.error%}</td>
{% } else { %}
<td class="preview">{% if (file.thumbnail_url) { %}
<a href="{%=file.url%}" title="{%=file.name%}" rel="gallery" download="{%=file.name%}"><img src="{%=file.thumbnail_url%}"></a>
{% } %}</td>
<td class="name">
<a href="{%=file.url%}" title="{%=file.name%}" rel="{%=file.thumbnail_url&&'gallery'%}" download="{%=file.name%}">{%=file.name%}</a>
</td>
<td class="size"><span>{%=o.formatFileSize(file.size)%}</span></td>
<td colspan="2"></td>
{% } %}
<td class="delete">
<button class="btn btn-danger" data-type="{%=file.delete_type%}" data-url="{%=file.delete_url%}">
<i class="icon-trash icon-white"></i>
<span>{%=locale.fileupload.destroy%}</span>
</button>
<input type="checkbox" name="delete" value="1">
</td>
</tr>
{% } %}
</script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<!-- The jQuery UI widget factory, can be omitted if jQuery UI is already included -->
<script src="blueimp/js/vendor/jquery.ui.widget.js"></script>
<!-- The Templates plugin is included to render the upload/download listings -->
<script src="http://blueimp.github.com/JavaScript-Templates/tmpl.min.js"></script>
<!-- The Load Image plugin is included for the preview images and image resizing functionality -->
<script src="http://blueimp.github.com/JavaScript-Load-Image/load-image.min.js"></script>
<!-- The Canvas to Blob plugin is included for image resizing functionality -->
<script src="http://blueimp.github.com/JavaScript-Canvas-to-Blob/canvas-to-blob.min.js"></script>
<!-- Bootstrap JS and Bootstrap Image Gallery are not required, but included for the demo -->
<script src="http://blueimp.github.com/cdn/js/bootstrap.min.js"></script>
<script src="http://blueimp.github.com/Bootstrap-Image-Gallery/js/bootstrap-image-gallery.min.js"></script>
<!-- The Iframe Transport is required for browsers without support for XHR file uploads -->
<script src="blueimp/js/jquery.iframe-transport.js"></script>
<!-- The basic File Upload plugin -->
<script src="blueimp/js/jquery.fileupload.js"></script>
<!-- The File Upload file processing plugin -->
<script src="blueimp/js/jquery.fileupload-fp.js"></script>
<!-- The File Upload user interface plugin -->
<script src="blueimp/js/jquery.fileupload-ui.js"></script>
<!-- The localization script -->
<script src="blueimp/js/locale.js"></script>
<!-- The main application script -->
<script src="blueimp/js/main.js"></script>
<!-- The XDomainRequest Transport is included for cross-domain file deletion for IE8+ -->
<!--[if gte IE 8]><script src="js/cors/jquery.xdr-transport.js"></script><![endif]-->
THE SECOND VIEW ('FORM') BEGINS HERE.
<div class="container">
<base href="http://localhost/bootstrap1/">
<!-- <div class="row">-->
<fieldset>
<legend>Registration</legend>
<div class="span10" class="well">
<form class="well" id="registerHere" method='post' action='index.php/site/process_form'>
//
<div class="form_row" >
<div class="control-group">
<label class="control-label" for="textarea">Textarea</label>
<div class="controls">
<textarea class="span8" class="input-xlarge" id="description" name="description" rel="popover" data-content="Re-enter your description." data-original-title="description" rows="3"></textarea>
</div>
</div>
</div>
<div class="form_row" >发布于 2012-08-11 21:35:39
我没有想到“链接腐烂”。在任何情况下,以下都是问题的答案:
我正在使用bootstrap工具包,并试图在bootstrap容器标记中创建自包含的视图。我设置它的方式是:
标题
视图A: HTML放在这里css和js
视图B: HTML放在这里css和js
页脚
当我连接两个视图时,我有一个重复的jquery脚本,在我的例子中导致了firebug中的以下错误:
$(”#fileupload”).fileupload is not a function
[Break On This Error]
$(’#fileupload’).fileupload();考虑到我目前糟糕的JS技能,我仍然不明白这是什么意思,但是一旦我注释掉第二个脚本,整个页面就开始像预期的那样工作了。
https://stackoverflow.com/questions/11744647
复制相似问题