本文整理汇总了PHP中Pagination::setBaseUrl方法的典型用法代码示例。如果您正苦于以下问题:PHP Pagination::setBaseUrl方法的具体用法?PHP Pagination::setBaseUrl怎么用?PHP Pagination::setBaseUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pagination
的用法示例。
在下文中一共展示了Pagination::setBaseUrl方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
$data = array();
$blogCollection = new BlogCollection();
$page = isset($_GET['page']) ? (int) $_GET['page'] : 1;
$perPage = 5;
$offset = $page ? ($page - 1) * $perPage : 0;
$rows = count($blogCollection->getAll());
$pagination = new Pagination();
$pagination->setPerPage($perPage);
$pagination->setTotalRows($rows);
$pagination->setBaseUrl("http://localhost/Lectures/Lek15/softacadTours/index.php?c=blog&m=index");
$blogs = $blogCollection->getAll(array(), $offset, $perPage);
$data['blogs'] = $blogs;
$data['pagination'] = $pagination;
$this->loadFrontView('blog/listing', $data);
}
示例2: index
public function index()
{
if (!$this->loggedIn()) {
header('Location: index.php?c=login&m=login');
}
$data = array();
$usersCollection = new UserCollection();
$page = isset($_GET['page']) ? (int) $_GET['page'] : 1;
$perPage = 5;
$offset = $page ? ($page - 1) * $perPage : 0;
$rows = count($usersCollection->getAll());
$pagination = new Pagination();
$pagination->setPerPage($perPage);
$pagination->setTotalRows($rows);
$pagination->setBaseUrl("http://localhost/Lectures/Lek15/softacadTours/admin/index.php?c=user&m=index");
$users = $usersCollection->getAll(array(), $offset, $perPage);
$data['users'] = $users;
$data['pagination'] = $pagination;
$this->loadView('users/listing', $data);
}
示例3: index
public function index()
{
$data = array();
$categoryId = isset($_GET['id']) ? $_GET['id'] : 0;
$toursCollection = new ToursCollection();
$page = isset($_GET['page']) ? (int) $_GET['page'] : 1;
$perPage = 6;
$offset = $page ? ($page - 1) * $perPage : 0;
if ($categoryId > 0) {
$where = array('category_id' => $categoryId);
$rows = count($toursCollection->getAll($where));
$tours = $toursCollection->getAll($where, $offset, $perPage);
} else {
$rows = count($toursCollection->getAll());
$tours = $toursCollection->getAll(array(), $offset, $perPage);
}
$pagination = new Pagination();
$pagination->setPerPage($perPage);
$pagination->setTotalRows($rows);
$pagination->setBaseUrl("http://localhost/Lectures/Lek15/softacadTours/index.php?c=tours&m=index&id=" . $categoryId);
$data['pagination'] = $pagination;
$data['tours'] = $tours;
$this->loadFrontView('tours/listing', $data);
}
示例4: index
public function index()
{
$data = array();
if (!$this->loggedIn()) {
header('Location: index.php?c=login&m=login');
}
$search = isset($_GET['search']) ? $_GET['search'] : '';
if (trim($search) != '') {
$like = array('name', htmlspecialchars(trim($search)));
} else {
$like = array();
}
$perPageSelect = isset($_GET['perPage']) ? (int) $_GET['perPage'] : 0;
switch ($perPageSelect) {
case 0:
$perPage = 10;
break;
case 1:
$perPage = 5;
break;
case 2:
$perPage = 10;
break;
case 3:
$perPage = 20;
break;
case 4:
$perPage = 50;
break;
default:
$perPage = 10;
}
$orderBy = isset($_GET['orderBy']) ? (int) $_GET['orderBy'] : 0;
switch ($orderBy) {
case 0:
$order = array('id', 'DESC');
break;
case 1:
$order = array('name', 'ASC');
break;
case 2:
$order = array('name', 'DESC');
break;
case 3:
$order = array('category_id', 'ASC');
break;
case 4:
$order = array('category_id', 'DESC');
break;
default:
$order = array('id', 'DESC');
}
$page = isset($_GET['page']) ? (int) $_GET['page'] : 1;
$offset = $page ? ($page - 1) * $perPage : 0;
$toursCollection = new ToursCollection();
$rows = count($toursCollection->getAll(array(), -1, 0, $order, $like)) == 0 ? 1 : count($toursCollection->getAll(array(), -1, 0, $order, $like));
$pagination = new Pagination();
$pagination->setPerPage($perPage);
$pagination->setTotalRows($rows);
$pagination->setBaseUrl("http://localhost/Lectures/Lek15/softacadTours/admin/index.php?c=tour&m=index&perPage={$perPageSelect}&orderBy={$orderBy}&search={$search}");
$tours = $toursCollection->getAll(array(), $offset, $perPage, $order, $like);
$data['tours'] = $tours;
$data['pagination'] = $pagination;
$data['search'] = $search;
$data['perPageSelect'] = $perPageSelect;
$data['orderBy'] = $orderBy;
$data['page'] = $page;
$this->loadView('tours/listing', $data);
}
示例5: UserCollection
<th>Username</th>
<th>Email</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<?php
$usersCollection = new UserCollection();
$page = isset($_GET['page']) ? (int) $_GET['page'] : 1;
$perPage = 5;
$offset = $page ? ($page - 1) * $perPage : 0;
$rows = count($usersCollection->getAll());
$pagination = new Pagination();
$pagination->setPerPage($perPage);
$pagination->setTotalRows($rows);
$pagination->setBaseUrl("http://localhost/Lectures/Lek15/softacadTours/admin/users.php");
$users = $usersCollection->getAll(array(), $offset, $perPage);
foreach ($users as $user) {
?>
<tr>
<td><?php
echo $user->getUsername();
?>
</td>
<td class="center"><?php
echo $user->getEmail();
?>
</td>
<td class="center"><?php
echo $user->getDescription();
?>