This is a plugin for bBlog, which allows for navigation of your blog via pages. In your index and archive pages, you can allow your users to view all your entries in pages instead of only a predefined number of entries.

This plug-in was developed using bBlog 0.7.3. It may work well with other versions; but I have not tried it myself.

If you have any questions or comments on this plug-in, please contact me directly.


You can download the latest version at: http://www.eyt.ca/Software/bblogs-nextprev-0.4.2.tar.gz.


  • Initial version.
  • Added the ability to enumerate the pages.
  • Added support to limit the number of enumerate pages.
  • Added support for additional query parameters via the query parameter and link parameters via the link parameter.
  • Improved documentation
  • Now includes sample templates.
  • Added support for specifying the post array instead of it querying. This allows this plug-in to work with the search plugin.
  • Added templates for the Search plugin, since it requires some slight modifications.
  • Fix for Clean URLs and sections.
  • Updated a few templates.
  • Added the home parameter for supporting hide from homepage


To install this plugin, simply

  1. Copy function.nextprev.php to your bBlog_plugins directory.
  2. If you are using bBlog 0.7.3 and you wish to use this for the archive page, you will require the patch for bug 855654 available here, or you can simply copy the included function.getarchiveposts.php to your bBlog_plugins (for 0.7.3).
  3. If you are using bBlog 0.7.3 and you wish to use this for a page that uses getrecentposts, you will need the patch with the bug 976359, or you can simply copy the included function.getrecentposts.php to your bBlog_plugins (for 0.7.3).
  4. If you wish to use this for the Search plugin, you will need to use the search.php and search.html templates as provided in the lines directory, which change the functionality of the form from POST to GET. The plugin can be acquired from here, and follow its directions, with the exception of the search.php and search.html files.
  5. In your bBlog Plugin list, click the Scan for new plugins button, or Refresh All if you are upgrading from a previous version.

You are now ready to use the new plug-in.

For more information, please see the bBlog Plugin Documentation.

Using the Plugin

Included in the distribution is the modified files of lines template to use this plugin as described below. You can either use this directly or as a reference.

To use the plugin, you will have to edit your template files.

  1. Make a backup of your template files just in case.
  2. Place {nextprev} at the top of your template file. This defaults to displaying 20 entries per page; if you want to change this, set the num parameter, such as {nextprev num=5}.
  3. Within your page, use the $current_offset variable, such as in {getrecentposts num=5 skip=$current_offset assign=posts home=true}.
  4. Add the Next/Previous code via

    {if $gonext ne ""}
    <a href="{$gonext}">Next</a>
    {if $goprev ne ""}
    <a href="{$goprev}">Previous</a>

  5. If you want to use the link references in your header (to use things like Mozilla's Link Toolbar), you need to have the {nextprev} prior to the inclusion of the header, and modify your header.html file to include:

    {if $gonext ne ""}
    <link rel="next" type="text/html" href="{$gonext}" />
    {if $goprev ne ""}
    <link rel="prev" type="text/html" href="{$goprev}" />

  6. If you want to list your pages out, you can use the {$getprevpages} and {$getnextpages} in your pages, such as follows:

    {foreach from=$goprevpages item=page}
     <a href="{$page.url}">{$page.page}</a>&nbsp;
    {foreach from=$gonextpages item=page}
     <a href="{$page.url}">{$page.page}</a>&nbsp;

And you're ready try your pages.


numNumber of entries per page; The default is 20.
max_pagesThis is the maximum number of pages to list in the goprevpages and gonextpages pages.
queryThis parameter allows you to assign more query parameters if desired.
linkTo add some parameters to the generated link, use this variable. This form is &variable=value.
postsInstead of this plugin querying the database to count entries, it will count these entries instead. This invalidates the query parameter.
adjustWhen posts is used, this parameter will adjust the array according to the parameters; if it it is not set, the array will need to be adjusted externally, and I am not sure how.
homeSet home=true when you are using the hide from homepage feature of bBlog.

Variables Assigned

current_offsetThis is the current index of the entry at the top of the page. In other words, this is current_page * entries per page
current_pageThis is the index of the current page (starting at 1).
When using the parameter max_pages, this is the index of the first/last page in the goprevpages/gonextpages.
gonum_pagesThis is the total number of pages that could be displayed.
This is an array of pages before and after, respectively, the current_page. The array contains the page (index of) and url (URL to display the page).
This is the link to the previous and next page, respectively.