コード例 #1
0
ファイル: categories.php プロジェクト: walternate/Back-End
$page = 1;
$count = count($categories);
$pages = intval($count / Constants::NO_OF_ITEMS_PER_PAGE);
$search_criteria = "";
if (isset($_POST['button_search'])) {
    $search_criteria = trim(strip_tags($_POST['search']));
    $categories = $controller->getCategoriesBySearching($search_criteria);
} else {
    if ($count % Constants::NO_OF_ITEMS_PER_PAGE != 0) {
        $pages += 1;
    }
    if (!empty($_GET['page'])) {
        $page = $_GET['page'];
        $begin = ($page - 1) * Constants::NO_OF_ITEMS_PER_PAGE;
        $end = Constants::NO_OF_ITEMS_PER_PAGE;
        $categories = $controller->getCategoriesAtRange($begin, $end);
    } else {
        $begin = ($page - 1) * Constants::NO_OF_ITEMS_PER_PAGE;
        $end = Constants::NO_OF_ITEMS_PER_PAGE;
        $categories = $controller->getCategoriesAtRange($begin, $end);
    }
}
?>


<!DOCTYPE html>
<html lang="en"><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">