gpt4 book ai didi

php - 分页在 codeigniter 中不起作用

转载 作者:行者123 更新时间:2023-11-29 19:46:06 26 4
gpt4 key购买 nike

使用分页列出医生信息。而是在一页中列出数据库中的所有医生信息。

Controller

public function doctor_userlist_view($offset = 0)
{
$config["base_url"] = base_url() . "User/doctor_userlist_view/";
$config['total_rows'] = $this->db->count_all_results('tbl_doctor');
$config['per_page'] = 4;
$config['full_tag_open'] = '<ul class="pagination">';
$config['full_tag_close'] = '</ul>';
$config['first_link'] = false;
$config['last_link'] = false;
$config['first_tag_open'] = '<li>';
$config['first_tag_close'] = '</li>';
$config['prev_link'] = 'Prev';
$config['prev_tag_open'] = '<li class="prev">';
$config['prev_tag_close'] = '</li>';
$config['next_link'] = 'Next';
$config['next_tag_open'] = '<li>';
$config['next_tag_close'] = '</li>';
$config['last_tag_open'] = '<li>';
$config['last_tag_close'] = '</li>';
$config['cur_tag_open'] = '<li class="active"><a href="#">';
$config['cur_tag_close'] = '</a></li>';
$config['num_tag_open'] = '<li>';
$config['num_tag_close'] = '</li>';
$this->pagination->initialize($config);
$data['docList'] = $this->User_model->get_all_userdoctor($config['per_page'], $offset);
$data['get_specs'] = $this->specialisation_model->get_specialisation();
$data['docsideList'] = $this->User_model->get_all_userdocside();
$data['get_specs'] = $this->specialisation_model->specialisation_get();
$this->load->view('customer/header', $data);
$this->load->view('customer/side_view', $data);
$this->load->view('customer/doctor', $data);
$this->load->view('customer/footer');
}

我的观点

<div class="list">
<ul>
<?php
if(isset($docList)):
foreach ($docList->result() as $row):
?>
<li><div class="imgt"><img src="<?php echo base_url("./resources/images/"); if($row->dr_img) echo $row->dr_img; else echo "no-img.jpg"; ?>" height="90px" width="82px"></div><div class="text"><h3><b>Dr. <?php echo $row->dr_name;?></b><br></h3><p><?php echo $row->spec_specialise; ?><br><?php echo $row->district;?><br><?php echo $row->state;?></p></div><div class="text"></div><div class="link"><a href="<?php echo site_url('User/doctor_details_view/'.$row->id); ?>"><i class="ace-icon fa fa-eye sym"></i>View</a></div></li>
<?php endforeach;
endif;
?>
</ul>
<div class="space">
</div>
</div></div>
<div class="pdt_rightt">
<center>
<?php
echo $this->pagination->create_links();
?>
</center>
</div>

在显示相同数据的所有链接中分页无法正常工作。我使用相同的代码列出该分页正常工作的医院。

最佳答案

您正在定义 $data['get_specs'] 两次,就像这样......

   // This instance of $data['get_specs'] is never being used as it's over written by the one below.    
$data['get_specs'] = $this->specialisation_model->get_specialisation();
$data['docsideList'] = $this->User_model->get_all_userdocside();
$data['get_specs'] = $this->specialisation_model->specialisation_get();

那么它是哪一个呢?

关于php - 分页在 codeigniter 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40967779/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com