O'Reilly logo

CouchDB and PHP Web Development Beginner's Guide by Tim Juravich

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action — adding frontend support for pagination

We almost have complete support for pagination. All we need to do now is add a little bit of HTML and JavaScript to our project, and we'll have a nice experience.

  1. Let's start by adding a line of CSS into our master.css file, so that our Load More button will look pretty.
    #load_more a {padding: 10px 0 10px 0; display: block; text-align: center; background: #e4e4e4; cursor: pointer;}
    
  2. Now that we have the CSS in place, let's add the HTML for our Load More button at the bottom of the post list inside our profile.php view.
    <h2>
    Posts (<span id="post_count"><?php echo $post_count; ?></span>)
    </h2>
    <div id="post_list">
    <?php include('_posts.php'); ?>
    </div>
    <div id="load_more" class="row"> <div class="span8"> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required