[eluser]Cgull[/eluser]
Hello,
I have a problem with bootstrap and codeigniter.
Hope someone can help.
I have a view called homepage with a link in it:
Code:
<a href="<?php echo site_url('page/backissues/thinklocal/') . '/' . $province->id; ?>">View Back Issues</a>
This view is calling this controller function:
Code:
public function backissues()
{
$magazine = $this->uri->segment(3);
$province_id = $this->uri->segment(4);
$this->load->model('province_m');
$this->load->model('province_issues_m');
$province = $this->province_m->get($province_id);
$this->data['folder'] = $province->folder;
$this->data['issues'] = $this->province_issues_m->get_backissues($province_id);
$this->data['subview'] = 'backissues';
$this->load->view('_modal_layout', $this->data);
}
The _modal_layout view looks like this:
Code:
<?php $this->load->view('components/page_head'); ?>
<body #555;">
<div id="myModal" class="modal show" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<?php $this->load->view($subview); // Subview is set in controller ?>
<div class="modal-footer">
<button class="btn" id="myclose" data-dismiss="modal" aria-hidden="true">Close</button>
<p center">© <?php echo date('Y'); ?> <?php echo config_item('site_name'); ?></p>
</div>
</div>
[removed]
$(function() {
$('#myclose').click(function() {
$('#myModal').hide();
});
});
[removed]
</body>
</html>
The backissues view:
Code:
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">x</button>
<h2 id="myModalLabel">View Back Issues</h2>
</div>
<div class="modal-body">
<?php if($issues): ?>
<table class="table table-hover">
<?php foreach($issues as $issue): ?>
<thead>
<tr>
<th>Issue Date</th>
<th>View Issue</th>
</tr>
</thead>
<tbody>
<tr>
<td><?php echo mdate('%d/%m/%Y', strtotime($issue->issue_date)); ?></td>
<td><img class="thumb" src="<?php echo site_url('uploads/issues') . '/' . $folder . '/thinklocal/img/' . $issue->thinklocal_img; ?>" /></td>
</tr>
</tbody>
<?php endforeach; ?>
</table>
<?php else: ?>
<p>No back issues were found for this province.</p>
<?php endif; ?>
</div>
When I click the close button on the modal, the modal closes but it does not go back to the homepage view, I just see a grey screen.
If I remove the modal.hide() script, nothing happens when I click the close button.
So how can I close the modal window?
Thank you.