<?php

require_once "include/products.php";
echo "<pre>";
var_dump(get_products_subset(1, 4));
// redirect too-large page numbers to the last page
if ($current_page > $total_pages) {
    header("Location: ./?pg=" . $total_pages);
}
// redirect too-small page numbers (or strings converted to 0) to the first page
if ($current_page < 1) {
    header("Location: ./");
}
// determine the start and end article for the current page; for example, on
// page 3 with 8 articles per page, $start and $end would be 17 and 24
$start = ($current_page - 1) * $products_per_page + 1;
$end = $current_page * $products_per_page;
if ($end > $total_products) {
    $end = $total_products;
}
$products = get_products_subset($start, $end);
$pageTitle = "";
$section = "services";
include ROOT_PATH . 'inc/header.php';
?>
		<h1>Services</h1>
		<div class="section services page">

			<div class="wrapper">

				

				<?php 
include ROOT_PATH . "inc/partial-list-navigation.html.php";
?>
Exemple #3
0
$pageTitle = "Mike's Full Catalog of Shirts";
$section = "shirts";
require_once '../inc/config.php';
require_once ROOT_PATH . "inc/header.php";
include ROOT_PATH . "inc/products.php";
// assigns the number of pages our navigation will have in $pages from the function get_products_pages
$pages = get_products_pages();
// if GET[pg] is set assign current_page to GET[pg] and get subset of shirts to display
// if there is no GET[pg] then assign current_page = to page 1 and get the products for page 1
if (isset($_GET["pg"])) {
    $current_page = $_GET["pg"];
    $products = get_products_subset($current_page);
} else {
    $current_page = 1;
    $products = get_products_subset($current_page);
}
// if current_page has a value higher than the # of pages, set page to last page in navigation
if ($current_page > $pages) {
    header("Location: ./?pg=" . $pages);
}
// if current_page has a value less than 1, set current_page to 1
if ($current_page < 1) {
    Header("Location: ./");
}
?>
		<div class="section shirts page">

			<div class="wrapper">

				<h1>Mike&rsquo;s Full Catalog of Shirts</h1>