diff --git a/public_html/index.php b/public_html/index.php index d123d3d..22ddb32 100644 --- a/public_html/index.php +++ b/public_html/index.php @@ -2,9 +2,11 @@ require_once '../resources/config.php'; require_once(LIBRARIES_PATH . "/Prismic.php"); + $page = isset($_GET['page']) ? $_GET['page'] : 1; + try { $ctx = Prismic::context(); - $documents = $ctx->getApi()->forms()->everything->ref($ctx->getRef())->submit(); + $documents = $ctx->getApi()->forms()->everything->page($page)->ref($ctx->getRef())->submit(); } catch (Guzzle\Http\Exception\BadResponseException $e) { Prismic::handlePrismicException($e); } @@ -16,7 +18,7 @@ require_once(TEMPLATES_PATH . "/header.php"); ?> -
@@ -44,4 +46,6 @@ getApi()->forms()->everything->query($q)->ref($ctx->getRef())->submit(); + $page = isset($_GET['page']) ? $_GET['page'] : 1; + $documents = $ctx->getApi()->forms()->everything->query($q)->page($page)->ref($ctx->getRef())->submit(); } catch (Guzzle\Http\Exception\BadResponseException $e) { Prismic::handlePrismicException($e); } @@ -36,5 +37,10 @@ + + $q + ); if (isset($maybeRef)) { $parameters['ref'] = $maybeRef; } diff --git a/resources/templates/pagination.php b/resources/templates/pagination.php new file mode 100644 index 0000000..3ac387e --- /dev/null +++ b/resources/templates/pagination.php @@ -0,0 +1,48 @@ + + +getTotalPages()>1) { ?> + +