我的插件使用 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" >