Forum

Thread tagged as: Question

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"> &laquo; 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 &raquo;</h3>
                                </div>
</a></perch:if>
Jade Marling

Jade Marling 0 points

  • 2 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

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:

ID  Value
domain  https://arthur.web-design.wales
url https://arthur.web-design.wales/agent/module-1/rent-smart-wales.php?s=landlords-must
sharing_image   /images/slider-01.jpg
twittername @DawsonsProperty
perch_page_path /agent/module-1/rent-smart-wales.php
is_prev true
_id 21
title   Outline of the new legislation
slug    outline-of-the-new-legislation
lead    All private landlords must register themselves and the addresses of their rental properties in{...}
conte   

    Licensed landlords and agents are required to comply with the licence conditions and the Code of Practice for landlords and agents under Part 1 of the Housing (Wales) Act 2014
    Housing is a devolved function and administered by the Welsh government.
    Since November 2016 there have been numerous fixed penalty notices issued, and prosecutions under new legislation.
    The Local Authorities where rental properties are located are responsible for any necessary enforcement action against non-compliance.

_page   /agent/module-1/rent-smart-wales.php
_pageID 14
_sortvalue  1000
perch_item_first    true
perch_item_last true
perch_item_zero_index   0
perch_item_index    1
perch_item_rev_index    1
perch_item_rev_zero_index   0
perch_item_odd  
perch_item_count    1
perch_namespace perch:content

and this next to next:

ID  Value
domain  https://arthur.web-design.wales
url https://arthur.web-design.wales/agent/module-1/rent-smart-wales.php?s=landlords-must
sharing_image   /images/slider-01.jpg
twittername @DawsonsProperty
perch_page_path /agent/module-1/rent-smart-wales.php
is_prev false
_id 23
title   Landlord Resposibilities
slug    landlord-resposibilities
lead    Landlords responsible for letting and management of rental property/ies, will have to obtain a{...}
conte   

    Be a fit and proper person
    Pay a licence fee
    Complete approved RSW course
    Agree to adhere to a Code of Practice
    Agree to adhere to the licence conditions

_page   /agent/module-1/rent-smart-wales.php
_pageID 14
_sortvalue  1002
perch_item_first    true
perch_item_last true
perch_item_zero_index   0
perch_item_index    1
perch_item_rev_index    1
perch_item_rev_zero_index   0
perch_item_odd  
perch_item_count    1
perch_namespace perch:content
Drew McLellan

Drew McLellan 2638 points
Perch Support

Ah, sorry, you'll also need to turn pagination on in your perch_content_custom() options.