【发布时间】:2016-04-01 00:30:36
【问题描述】:
只是一个简单的问题,询问是否有人可以帮助我。请查看我的索引页面上的此部分:
<?php foreach($galleries as $item) { ?>
<div class="col-md-2">
<p>Eagle Fruit <?= $item['gallery_name'] ?></p>
<img src="<?php echo base_url() . 'assets/img/site/' . $item['gallery_cover'] ?>" class="img-responsive">
<a href="<?= base_url();?>view/<?= $item['gallery_name'];?>" data-toggle="modal" data-target="#gallery">View the Gallery</a>
</div>
<?php } ?>
我的控制器设置了以下功能
<?php defined('BASEPATH') OR exit('No direct script access allowed');
class Site extends MX_Controller {
public function __construct()
{
parent::__construct();
$this->load->model('gallery/Gallery_m');
}
public function index($id = 'ID')
{
$data['title'] = 'Welcome to Eagle Fruit Alliance (Pty) Ltd';
$data['galleries'] = $this->Gallery_m->get_galleries();
$data['gallery'] = $this->Gallery_m->view($id);
$data['content'] = 'index_view';
$this->load->view('templates/site/template',$data);
}}
现在,当我单击链接时,我希望画廊以模式打开,我将如何实现这一点?我添加了一个带有以下代码的模态我哪里出错了:
模态
<!-- Modal -->
<div class="modal fade" id="gallery" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
<h4 class="modal-title" id="myModalLabel"><?= $gallery['name'];?></h4>
</div>
<div class="modal-body">
...
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<!-- ./Model -->
【问题讨论】:
-
模型是否放置在同一视图中??
-
是的,但如果可能的话,我希望将其移至自己的视图
-
没有。保持相同的视图
-
好的,当它在同一个视图中时,我如何让每个 ID 的信息显示?
-
我不懂ajax :-(
标签: php html mysql codeigniter