我的文件像(例如)显示在
中document.php有以下html来显示文件:
<section class="three-fourth">
<div class="sort-by">
<h3>Sort by</h3>
<ul class="sort">
<li>Date <a href="#" title="ascending" class="ascending">ascending</a><a href="#" title="descending" class="descending">descending</a></li>
<li>Name <a href="#" title="ascending" class="ascending">ascending</a><a href="#" title="descending" class="descending">descending</a></li>
<li>Category <a href="#" title="ascending" class="ascending">ascending</a><a href="#" title="descending" class="descending">descending</a></li>
</ul>
<ul class="view-type">
<li class="grid-view"><a href="#" title="grid view">grid view</a></li>
<li class="list-view"><a href="#" title="list view">list view</a></li>
</ul>
</div>
<div class="deals clearfix">
<!--deal-->
<?php
$id = $_GET['cat'];
$base_obj = new Base();
$lst = $base_obj->list_doc($id);
$lst->execute();
foreach ($lst as $rec)
{
$sub_head = $rec['Head_Id'];
$get_sub = $base_obj->list_by_id('Head_Id', $sub_head, 'tbl_heading');
$get_sub->execute();
foreach ($get_sub as $h)
{
$heading = $h['Head_Name'];
}
?>
<article class="one-fourth">
<figure><span style="float:left"><a href="hotel.html" title=""><img src="images/uploads/london1.jpg" alt="" style="width:100px" /></a></span><span style="float:left"><a href="#" title="Book now" class="gradient-button-green"></a></span></figure>
<div class="details">
<h1><?=$rec['Doc_Name'];?></h1>
<span class="address"><?=$heading;?></span>
<span class="price">Added On <em><?=substr($rec['Uploaded_Date_Time'],0,10);?></em> </span>
<a href="<?=substr($rec['Doc_Location'],3);?>" title="Book now" class="gradient-button">Download</a>
</div>
</article>
<!--//deal-->
<?php
} ?>
<!--bottom navigation-->
<div class="bottom-nav">
<!--back up button-->
<a href="#" class="scroll-to-top" title="Back up">Back up</a>
<!--//back up button-->
<!--pager-->
<div class="pager">
<span><a href="#">First page</a></span>
<span><a href="#"><</a></span>
<span class="current">1</span>
<span><a href="#">2</a></span>
<span><a href="#">3</a></span>
<span><a href="#">4</a></span>
<span><a href="#">5</a></span>
<span><a href="#">6</a></span>
<span><a href="#">7</a></span>
<span><a href="#">8</a></span>
<span><a href="#">></a></span>
<span><a href="#">Last page</a></span>
</div>
<!--//pager-->
</div>
<!--//bottom navigation-->
</div>
</section>
<!--//three-fourth content-->
</div>
<!--//main content-->
</div>
<div class="wrap clearfix">
<!--info boxes--><!--//info boxes-->
</div>
你们可以建议一种方式来展示有限的没有。一页中的pdf文件?
答案 0 :(得分:1)
以下是您需要更改功能的方法:
public function list_doc($cat, $page=0) {
$itemsPerPage = 20;
$cat = intval($cat, 10);
$start = intval($page, 10) * $itemsPerPage;
if ($start < 0) $start = 0;
$qry = $this->dbobj->db1->prepare("SELECT SQL_CALC_FOUND_ROWS *
FROM tbl_documents, tbl_cat_head_doc
WHERE tbl_cat_head_doc.Cat_Id = " . $cat ." AND
tbl_cat_head_doc.Doc_Id = tbl_documents.Doc_Id AND
tbl_documents.Status = 'a'
limit " . $start . "," . $itemsPerPage);
return $qry;
}
并在主页调用函数中如下:
$lst = $base_obj->list_doc($id, $_GET['page']);
以防止下一个问题:请阅读SQL_CALC_FOUND_ROWS and FOUND_ROWS()