[英]Codeigniter-Limit 2 image per page in window.print()
Good day everyone. 今天是个好日子。 So I have this working code that shows image from a folder using the image names that is saved in my database.
所以我有这个工作代码,它使用保存在数据库中的图像名称显示文件夹中的图像。 So basically, Folder(image_name) = Table(image_name).
因此,基本上,Folder(image_name)= Table(image_name)。
Model (print_model) 型号(print_model)
public function get_names($acknowledgement_key) {
$query = $this->db->select('*')
->from('TblPrintImage')
->where('acknowledgement_key', $acknowledgement_key)
->order_by('img_id', 'asc')
->get();
return $query->result();
}
View (print_view) 查看(print_view)
<?php foreach ($saved as $data) { ?>
<div class="row">
<div class="col-xs-12" >
<br>
<table class="table table-bordered table-condensed">
<tr style="text-align: center;font-family: Times New Roman;font-size: 16px;color: black; font-weight: bolder">
<td><br></td>
</tr>
<tr>
<td>
<div class="row">
<div class="col-xs-12">
<img src="<?php echo base_url("./uploads/" . $data->img_name . ".jpg"); ?>" width="650" height="224" alt=""/>
</div>
</div>
<div class="row">
<div class="col-xs-12" >
<textarea class="form-control" style="overflow: hidden; resize: none; border: 0; background: transparent; font-size: 14px;" maxlength="500" rows="5" name="" id="" ><?php echo $data->findings ?>
</textarea>
</div>
</div>
</td>
</tr>
</table>
</div>
</div>
<?php } ?>
Controller (print_controller) 控制器(print_controller)
public function print($acknowledgement_key) {
$data ['saved'] = $this->print_model->get_names($acknowledgement_key);
$this->load->view('print_view', $data);
}
The PROBLEM is, because it was called as an array, it will also show in a group of an array like this in window.print();. 问题是,因为它被称为数组,所以也会在window.print();中以数组的形式显示。
What I want is to limit in to 2 (two) image per page in window.print(); 我想要在window.print();中将每页限制为2(两)张图像; like this.
像这样。
I hope that I explained this will because i've been stuck in solving this since yesterday.
我希望我能说明这一点,因为自昨天以来我一直坚持解决这一问题。 Thanks guys.
多谢你们。
$this->db->limit(2);
to limit results to the first two images. 将结果限制为前两个图像。
What you want to achieve is known as Pagination in web development world. 您想要实现的目标在Web开发世界中被称为分页 。 You have not implemented any pagination logic.
您尚未实现任何分页逻辑。 You have to use Pagination to achieve desired result.
您必须使用分页才能获得所需的结果。
Refer this link for reference Pagination with CI . 请参考此链接以获取CI分页参考。
I hope this will give you fair idea. 希望这能给您一个好主意。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.