本文整理汇总了PHP中pagination::offset方法的典型用法代码示例。如果您正苦于以下问题:PHP pagination::offset方法的具体用法?PHP pagination::offset怎么用?PHP pagination::offset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pagination
的用法示例。
在下文中一共展示了pagination::offset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rtrim
$sql .= $value_oby . ' ' . $search_asc_desc[$key_oby] . ' ,';
$all_download_sql .= $value_oby . ' ' . $search_asc_desc[$key_oby] . ' ,';
}
$sql = rtrim($sql, ',');
$all_download_sql = rtrim($all_download_sql, ',');
} else {
$sql .= ' ORDER BY ' . $search_order_by . ' ' . $search_asc_desc;
$all_download_sql .= ' ORDER BY ' . $search_order_by . ' ' . $search_asc_desc;
}
}
$total_count = $class::count_all_by_sql($count_sql);
if (!empty($per_page)) {
$pagination = new pagination($pageno, $per_page, $total_count);
$pagination_statement = $pagination->show_pagination();
$sql .= " LIMIT {$per_page} ";
$sql .= " OFFSET {$pagination->offset()}";
}
$search_result = $class::find_by_sql($sql);
if (method_exists($class, 'search_add_extra_fields')) {
$class::search_add_extra_fields($search_result);
}
if (property_exists($class, 'search')) {
foreach (${$class}->search as $searchParaKey => $searchParaValue) {
$s->setProperty($searchParaKey, $searchParaValue);
}
}
$s->setProperty('result', $search_result);
$s->setProperty('_searching_class', $class);
$s->setProperty('_search_order_by', filter_input(INPUT_GET, 'search_order_by'));
$s->setProperty('_search_asc_desc', filter_input(INPUT_GET, 'search_asc_desc'));
$s->setProperty('_per_page', $per_page);
示例2: pagination
</span> </p>
<?php
/**
* prepare to paginate comments
* display paginated comments
* built pagination link
*/
//1. the current page number($current_page)
$paginate = !empty($_GET['paginate']) ? (int) $_GET['paginate'] : 1;
//2. records per page ($per_page)
$per_page = 3;
//3. total record count ($total_count)
$total_count = $dbo->count_number_rows($comment_set);
$pagination = new pagination($paginate, $per_page, $total_count);
$offset = $pagination->offset();
$comments = comment::paginate_comments($per_page, $offset);
?>
<?php
while ($comment = $dbo->fetch_assoc($comments)) {
$author = utility::remove_escape($comment["author"]);
$content = utility::remove_escape($comment["body"]);
echo "<p><code><strong>{$author}</strong><br />";
echo " {$content} </code></p>";
}
?>
<div id="pagination"><?php
echo $pagination->built_pagination_links($paginate);
?>