嗨,这可能是很明显的,但我是新来的分页,我认为CI的文档是真的垃圾,我期望得到的是一个链接列表和时我点击每一个应该显示每页3我的李项目,它显示链接列表和链接的工作,但它不显示每页的一定数量的结果,有没有人可以帮助我呢?CodeIgniter:分页显示链接,但不显示每页的确定结果
我的控制器部分:
public function clist()
{
//load the model that gets a list of clients
$this->load->model('list_model');
//call the function that lists clients and store the return data in a variable
$fields = $this->list_model->listcliname();
//create an array
$data = array();
//assign the data to a key in the array
$data['fields'] = $fields;
//pass the array to view for handling and load the view.
$this->load->library('pagination');
$config['base_url'] = site_url('clientlist/clist');
$config['total_rows'] = 500;
$config['per_page'] = 3;
$this->pagination->initialize($config);
echo $this->pagination->create_links();
$this->load->view('clientlist', $data);
笔者认为:
<html>
<head>
<title> client list </title>
<link rel="stylesheet" type="text/css" href="/css/clientlist.css">
<!-- add script to add jquery and add a function that performs a confirm on the event of a click on the delete link. -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('.confirmation').on('click', function() {
return confirm('Are you sure?');
});
});
</script>
</head>
<body>
<div id="container">
<?php
foreach($fields as $field) {
?>
<ul>
<li>
<?php echo $field['name']; ?>
</li>
<li>
<?php echo $field['contact']; ?>
</li>
<li>
<form action="clistedit" method="post">
<input type="hidden" name="sub" value="1" />
<input type="hidden" name="UID" value="<?php echo $field['UID']?>">
<button type="submit">edit</button>
</form>
</li>
<li>
<a href="/clientlist/delete/<?php echo $field['UID']; ?>/" class="confirmation">delete</a>
<a href="/clientlist/salelead/<?php echo $field['UID']; ?>/">view lead</a>
</li>
</ul>
<?php
}
?>
</div>
编辑:我必须某处配置哪些数据是分页或不链接到功能做到这一点?
echo'
';好像 ? – 2014-10-03 07:10:22它打印出我在第1页 – seanyt123 2014-10-03 07:13:47
和2等所有的数组,就像链接链接到完全相同的东西,只是没有限制。 – seanyt123 2014-10-03 07:14:28