Plugin: LMBlogPaginate

Lets you paginate the blog items on the index page and show a list of links that points to various pages of blog items.

General plugin info
Author:Leo
Current version:1.0.1
Download:NP_LMBlogPaginate_v101.zip
Support: Plugin comments or forum thread
Compability:Nucleus CMS 3.60, NP_LMReplacementVars 1.0.0

Plugin overview

The NP_LMBlogPaginate plugin gives you the possibility to paginate the blog items on the index page and show a list of links that points to various pages of blog items. The list of links are shown after the content. How many links to show in the list is set by parameters. If there are more pages than page slots in the list, are the page slots distributed to cover a representative range of the pages. How this distribution is done is defined by parameters.

The HTML generated by the plugin is fully customizable either by plugin options or by template fields.

The current skin variables in the Nucleus core for showing blog content on index pages does not have the possibility to have plugins filter the items shown. Because of this the NP_LMBlogPaginate plugin uses a helper plugin for handling item filtering. This plugin is called NP_LMReplacementVars and gives alternative implementations of some key Nucleus core skin variables. It must be installed before the NP_LMBlogPaginate plugin can be installed. The NP_LMReplacementVars plugin can be downloaded from the NP_LMReplacementVars plugin page.

If the NP_LMFancierURL plugin is installed will page keywords be used in URLs. The NP_LMFancierURL plugin can be downloaded from the NP_LMFancierURL plugin page.

Installation

  • Upload the NP_LMBlogPaginate.php file and the lmreplacementvars directory from the zip file to the Nucleus CMS plugins directory (nucleus/plugins) on your web server.
  • Go to the Plugins page in the admin area. You should be able to select the plugin in the dropdown list under the "Install New Plugin" section and press the "Install Plugin" button.

Upgrade

  • Take a backup of the current plugin files. You will need these if you want to rollback to the previous version after the upgrade.
  • Take a backup of the database used for you Nucleus installation.
  • Replace the old plugin files with the new ones. Do not uninstall the plugin.
  • If a plugin data upgrade is needed, will an upgrade plugin data option be available on the NP_LMBlogPaginate plugin admin page. Choose this option to upgrade the plugin data.
  • After the plugin data upgrade has been performed may a rollback option and a commit option be available on the NP_LMBlogPaginate plugin admin page. Not all upgrades support the rollback and commit option.
  • If you are not pleased with the new version of the plugin you may use the rollback option to rollback the plugin data upgrade. After the rollback of the plugin data upgrade you have to replace the new plugin files with the old plugin files.
  • If you are pleased with the new version of the plugin you should use the commit option to commit the plugin data upgrade. After the commit of the plugin data upgrade will any rollback and commit options disappear.

Configuration

The NP_LMBlogPaginate plugin has the following options on the global level:

  • Delete NP_LMBlogPaginate data on uninstall? - Choose if all data should be deleted when the plugin is uninstalled.
  • Paginator Header - Template for how to output the header for the page list. The following variables are available: <%contexturl%> (URL to the default index page).
  • Paginator Prev - Template for how to output the list item for the previous page link. The following variables are available: <%contexturl%> (URL to the previous index page), <%pagenumber%>, <%firstitem%> and <%lastitem%>.
  • Paginator No Prev - Template for how to output the list item for the previous page if the current page is the first page. The following variables are available: <%contexturl%> (URL to the default index page).
  • Paginator Page - Template for how to output the list item for a link to a page. The following variables are available: <%contexturl%> (URL to the page), <%pagenumber%>, <%firstitem%>, <%lastitem%> and <%aftergap%> (Is set to the string "aftergap" if this is the first page link after a page gap item in the link list, otherwise blank).
  • Paginator Current Page - Template for how to output the list item for the current page. The following variables are available: <%contexturl%> (URL to the page), <%pagenumber%>, <%firstitem%> and <%lastitem%>.
  • Paginator Gap - Template for how to output a page gap item in the page link list.
  • Paginator Next - Template for how to output the list item for the next page link. The following variables are available: <%contexturl%> (URL to the next page), <%pagenumber%>, <%firstitem%> and <%lastitem%>.
  • Paginator No Next - Template for how to output the list item for the next page if the current page is the last page. The following variables are available: <%contexturl%> (URL to the default index page).
  • Paginator Footer - Template for how to output the footer for the page list. The following variables are available: <%contexturl%> (URL to the default index page).

The NP_LMBlogPaginate plugin has fields that can be set in Nucleus templates. These fields can be used to override the value of the plugin option with the same names. The purpose of the plugin template fields is to be able do differentiate the layout by the different NP_LMBlogPaginate plugin variables on a Nucleus site by using the Nucleus template used to show items. The default value for the template fields (when empty) is to use the value of the corresponding plugin option. If you want to force a template field to produce a empty string add the value #empty# to the Nucleus template field.

Usage

After the plugin is installed you need to use the NP_LMReplacementVars skin variable for showing the index page (see the NP_LMReplacementVars section bellow) to be able to see the page link list.

The default values for the plugin options together with the CSS bellow will format the page list as a centered single row of links.

#lmbppagination { 
	margin: 10px 0 20px 0;
	padding: 0 0 0 0;
	text-align: center;
	font-size: 12px; 
	clear: both;
	list-style: none;
}

#lmbppagination li {
	display: inline;
	background: none;
	padding: 0px;
	margin: 0px;
}

#lmbpprev, #lmbpnext, #lmbpcurrentpage, a.lmbppage, a.lmbppageaftergap {
	padding: 3px 3px 3px 3px;
	border: 1px solid #989898;
	border-left: none;
	background-color: #FAE6F0;
	font-size: 10px;
}

a#lmbpprev, a#lmbpnext, #lmbpcurrentpage, a.lmbppage, a.lmbppageaftergap {
	color: #000;
}

a.lmbppageaftergap {
	border-left: 1px solid #989898;
}

span#lmbpprev, span#lmbpnext, .lmbppagegap {
	color: #777;
}

#lmbpcurrentpage {
	background-color: #FFF;
}

#lmbppagination a:hover {
	text-decoration: none;
	background-color: #E6E6FA;
	color: #000;	
}

#lmbppagination li:first-child a, #lmbppagination li:first-child span {
	border-left: 1px solid #989898;
}

#lmbppagination .lmbppagegap {
	padding: 3px 3px 3px 3px;
	font-size: 10px;
}

If the NP_LMFancierURL and NP_LMURLParts plugings are installed can you use the NP_LMURLParts plugin admin page to edit the page URL part keywords that NP_LMFancierURL should use. See the NP_LMURLPart plugin help page for more information on using the NP_LMURLParts plugin admin page.

NP_LMReplacementVars

The replacement skin variable for <%blog()%> in the NP_LMReplacementVars plugin must be used by your blog if you want this plugin to function. See the documentation for the NP_LMReplacementVars plugin for further information on how to use the blog replacement skin variable.

The NP_LMBlogPaginate plugin recognize the following dynamic parameter used by the NP_LMReplacementVars replacement for the blog skin variable:

  • lmblogpaginate - When set to disable will a page link list not be generated by this skin variable.
  • firstlast - Number of page list items to show for the first and last pages. Default value: 2.
  • current - Number of page list items to show on each side of the current page list item. Default value: 2.
  • between - Number of page list items to show between the current page list items and the first/last page list items. Only used if there is a gap in the list between the current page list items shown and the first/last page list items shown. It's recommended to set this to 0 if you have few pages on your blog. Default value: 2.

Example use of the blog skinvar replacement:

<%LMReplacementVars(Blog, lm/index, amount=10, between=0)%>

Events

Events this plugin triggers:

  • LMBlogPaginate_LinkParams - Subscribing plugins can add parameters to the page links generated by the plugin. Parameters in $data:
    • blog - Blog object.
    • linkparams - Associated array with page link parameters. Add the extra category link parameters required by your plugin to this array. Example: $data['linkparams']['parametername'] = $value;

Support and Bug reports

For additional support and/or bug reports please use the Nucleus forum plugin announce thread or the plugin page comment section.

Compability

This version of the NP_LMBlogPaginate plugin is tested against version 3.64 of Nucleus CMS. The minimum version of Nucleus CMS needed for using this plugin is 3.60 and the minimum version of the NP_LMReplacementVars plugin needed by this plugin is version 1.0.0. If the NP_LMFancierURL plugin is installed is the minimum version of the NP_LMFancierURL plugin needed by this plugin version 3.0.0, and if the NP_LMURLParts plugin is installed is the minimum version of the NP_LMURLParts plugin needed by this plugin version 1.1.1.

Version History

  • v1.0.0 2013-01-27: by Leo (http://www.slightlysome.net)
    • Initial release.
  • v1.0.1 2013-05-20: by Leo (http://www.slightlysome.net)
    • Changes for PHP 5.4.

Download

Download NP_LMBlogPaginate v1.0.1. The latest version of the NP_LMBlogPaginate plugin can be downloaded from the NP_LMBlogPaginate plugin page.

The latest version of the NP_LMReplacementVars plugin can be downloaded from the NP_LMReplacementVars plugin page.

The latest version of the NP_LMFancierURL plugin can be downloaded from the NP_LMFancierURL plugin page.

The latest version of the NP_LMURLParts plugin can be downloaded from the NP_LMURLParts plugin page.


Add Comment

Spam and off topic comments will be deleted.

Allowed BBCode:[b] [i] [u] [s] [color=] [size=] [quote] [code] [email] [url]