Forum
Page one of..
Hi!
I've added pagination on the bottom of a presentation, is there anyway of writing 'page ... of ...' of the perch_content_custom
details page?
I've followed the https://docs.grabaperch.com/perch/content/functions/how-do-i-link-prev-next/ doc but need a point of reference of where clients are on each section
Details page:
<?php include('../../admin/runtime.php');?>
<?php
if (!perch_member_logged_in() && !perch_member_has_tag('agent')) {
PerchSystem::redirect('/login.php');
};
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title><?php $my_var = perch_pages_title(true);
echo $my_var; ?></title>
<?php $page = 'module';?>
<?php
$domain = 'https://'.$_SERVER["HTTP_HOST"];
$url = $domain.$_SERVER["REQUEST_URI"];
$sitename = "Dawsons Training Wales";
$twittername = "@DawsonsProperty";
$sharing_image = '/images/slider-01.jpg';
PerchSystem::set_var('domain',$domain);
PerchSystem::set_var('url',$url);
PerchSystem::set_var('sharing_image',$sharing_image);
PerchSystem::set_var('twittername',$twittername);
perch_page_attributes(array(
'template' => 'default.html'
));
?>
<meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1">
<link rel="shortcut icon" href="../../favicon.ico">
<!-- Vendor -->
<link href="../../js/vendor/bootstrap/bootstrap.min.css" rel="stylesheet">
<link href="../../js/vendor/slick/slick.css" rel="stylesheet">
<link href="../../js/vendor/swiper/swiper.min.css" rel="stylesheet">
<link href="../../js/vendor/magnificpopup/dist/magnific-popup.css" rel="stylesheet">
<link href="../../js/vendor/nouislider/nouislider.css" rel="stylesheet">
<link href="../../js/vendor/darktooltip/dist/darktooltip.css" rel="stylesheet">
<link href="../../css/animate.css" rel="stylesheet">
<!-- Custom -->
<link href="../../css/style.css" rel="stylesheet">
<link href="../../css/megamenu.css" rel="stylesheet">
<!-- Color Schemes -->
<!-- your style-color.css here -->
<!-- Icon Font -->
<link href="../../fonts/icomoon-reg/style.css" rel="stylesheet">
<!-- Google Font -->
<link href="https://fonts.googleapis.com/css?family=Lato:300,300i,400,400i,500,500i,700,700i,900,900i" rel="stylesheet">
</head>
<body class="fullwidth open-panel">
<?php include('../../includes/header.php');
include('../../includes/module-nav-agent-1.php');?>
<!-- Page Content -->
<main class="page-main">
<div class="block">
<div class="container">
<div class="col-md-7">
<br><br>
<?php
perch_content_create('Housing (Wales) Act 2014 – Rent Smart Wales slides', array(
'template' => 'module.html',
'multiple' => true,
'edit-mode' => 'listdetail',
));
$slide = perch_content_custom('Housing (Wales) Act 2014 – Rent Smart Wales slides', array(
'template'=> 'module.html',
'filter' => 'slug',
'match' => 'eq',
'value' => perch_get('s'),
'count' => 1,
'skip-template' => true,
'return-html' => true,
));
echo $slide['html'];
?>
</div>
</div>
</div>
</main>
<!-- /Page Content -->
<footer class="page-footer fullwidth variant3">
<?php
PerchSystem::set_var('is_prev', true);
perch_content_custom('Housing (Wales) Act 2014 – Rent Smart Wales slides', array(
'template' => 'paginate.html',
'filter' => '_order',
'match' => 'lt',
'value' => $slide[0]['_sortvalue'],
'sort' => '_order',
'sort-order' => 'DESC',
'count' => 1,
));
PerchSystem::set_var('is_prev', false);
perch_content_custom('Housing (Wales) Act 2014 – Rent Smart Wales slides', array(
'template' => 'paginate.html',
'filter' => '_order',
'match' => 'gt',
'value' => $slide[0]['_sortvalue'],
'sort' => '_order',
'sort-order' => 'ASC',
'count' => 1,
));
?>
<div class="clearfix"></div>
<?php include('../includes/footer.php');?>
<!-- jQuery Scripts -->
<script src="../../js/vendor/jquery/jquery.js"></script>
<script src="../../js/vendor/bootstrap/bootstrap.min.js"></script>
<script src="../../js/vendor/swiper/swiper.min.js"></script>
<script src="../../js/vendor/slick/slick.min.js"></script>
<script src="../../js/vendor/parallax/parallax.js"></script>
<script src="../../js/vendor/isotope/isotope.pkgd.min.js"></script>
<script src="../../js/vendor/magnificpopup/dist/jquery.magnific-popup.js"></script>
<script src="../../js/vendor/countdown/jquery.countdown.min.js"></script>
<script src="../../js/vendor/nouislider/nouislider.min.js"></script>
<script src="../../js/vendor/ez-plus/jquery.ez-plus.js"></script>
<script src="../../js/vendor/tocca/tocca.min.js"></script>
<script src="../../js/vendor/bootstrap-tabcollapse/bootstrap-tabcollapse.js"></script>
<script src="../../js/vendor/scrollLock/jquery-scrollLock.min.js"></script>
<script src="../../js/vendor/darktooltip/dist/jquery.darktooltip.js"></script>
<script src="../../js/vendor/imagesloaded/imagesloaded.pkgd.min.js"></script>
<script src="../../js/vendor/instafeed/instafeed.min.js"></script>
<script src="../../js/megamenu.min.js"></script>
<script src="../../js/app.js"></script>
</body>
</html>
module.html
<p>Page 1 of 12</p>
<h2><perch:content id="title" type="text" label="Title"/></h2>
<perch:content id="slug" type="slug" for="title" suppress="true" ineditable="true"/>
<p class="lead"><perch:content id="lead" type="text" label="Lead sentence"/></p>
<perch:content id="conte" type="textarea" label="Content" html="true" editor="redactor"/>
paginate.html
<perch:if exists="is_prev"><a href="?s=<perch:content id="slug" type="slug">"><div class="col-md-6" style="background-color: #ededed; padding: 15px 30px;">
<h3 class="mb-0"> « Previous</h3>
</div>
</a>
<perch:else />
<a href="?s=<perch:content id="slug" type="slug">">
<div class="col-md-6" style="background-color: #00aab5; padding: 15px 30px; float: right">
<h3 class="text-white fright mb-0"> Next »</h3>
</div>
</a></perch:if>
If you put
<perch:showall>
in your template near the pagination controls, you'll see a table of all the IDs you can use to output information about the paging. That will include the current page and the total number of pages.So I have this next to previous:
and this next to next:
Ah, sorry, you'll also need to turn pagination on in your
perch_content_custom()
options.