我遇到了一个奇怪的错误(我使用codeigniter),标题和 jquery 选项卡显示了两次:
这是我header_v
的,jquery 选项卡的地方:
<script>
$(function() {
$( "#datepicker" ).datepicker();
});
$(function() {
$( "#tabs" ).tabs();
});
</script>
<div id="header"><h1>HEADER</h1></div>
<div id="tabs">
<ul>
<li><a href="umat">Daftar Umat</a></li>
<li><a href="#">Daftar Pengurus</a></li>
<li><a href="absensi">Absensi</a></li>
</ul>
</div>
这umat_v
是单击第一个选项卡时将加载的视图:
<body>
<div id="form_search">
<?php echo form_open('backend/index') ?>
<p>
Kelas :
<?php echo form_dropdown('ddl_kelas1', $list_kelas, 'id="ddl_kelas1"');?> -
<?php echo form_dropdown('ddl_kelas2', $list_kelas, 'id="ddl_kelas2"');?>
</p>
<p>
Nama : <?php echo form_input('txt_nama');?>
Alamat : <?php echo form_input('txt_alamat');?>
Tanggal Lahir : <input type="text" id="datepicker" />
</p>
<?php echo form_submit('btn_search', 'Search');?>
<?php echo form_close(); ?>
</div>
<div>
<?php echo $table ?>
<?php echo $pagination ?>
</div>
</body>
这是controller
我用来加载这些视图的:
public function umat() {
$this->load->view('template/header_v');
//check authorization
if(!isset($_SESSION['username']))
redirect('backend');
//pagination
$config['base_url'] = site_url('/backend/umat/');
$config['total_rows'] = $this->backend_m->count_umat();
$config['per_page'] = 10;
$config['uri_segment'] = 3;
$config['full_tag_open'] = '<div id="pagination">';
$config['full_tag_close'] = '</div>';
$this->pagination->initialize($config);
$data['pagination'] = $this->pagination->create_links();
//table
$data_umat = $this->backend_m->get_umat();
$this->table->set_heading(
'No',
'Nama',
'Kelas',
'Alamat',
'Sekolah',
'Nomor Telepon',
'Keterangan'
);
$no = 1;
foreach($data_umat as $list_temp)
{
$this->table->add_row(
$no++,
$list_temp->nama,
$list_temp->kelas,
$list_temp->alamat,
$list_temp->sekolah,
$list_temp->no_tlpn,
$list_temp->keterangan
);
}
$data_kelas = $this->backend_m->get_kelas();
$data['list_kelas'][0] = 'Pilih Kelas';
foreach($data_kelas as $row)
{
$data['list_kelas'][$row->kelas_id] = $row->kelas;
}
$data['table'] = $this->table->generate();
$this->load->view('backend/umat_v', $data);
}
为什么我的标题/header_v
总是加载 2 次?感谢:D