Pagination of the CMS Template

Some of the pages need paging function. For example, the blog top page needs pagination. This document page show you how to handle the function in this CMS.

Open the Blog top page Template with editor page

In order to learn how to implement the template with pagination, it is good way to take a look at actual template code and setting using the function.

Goto Primitive Template management page and open the "Latest blog articles" Primitive Template in the "blog parts" category  with the editor.

latest blog template

Setting for Paging

Click the "Paging" tab in the top tab menu of this editor page. Then the section to set paging setting appears.

Paging setting

This section has the "is paging" check box and paging code.

Enable paging

In order to enable the paging function for this template, click the "is paging" check box to set the status checked. And push the "Save" button. Then this template is for paging.

Server side program for paging

The "Paging" tab's section has coding area. You can write Alinous-Core script to return the number of pages. If your script returns 3. The template publishing engine publish 3 pages, that means it publish 3 times for each page parameter.

Get number of pages

The script in the "Paging" tab's section is to return the number of pages. The example source code is below.


Following parameter comes to this script when publishing engine execute this script to get the number of pages.

  • cms_page_id
  • node_id
  • publish

You can detect the page to publish by "cms_page_id" or "node_id" and calculate the number of pages by SELECT SQL.

This script editor is based on the Web  Based Editor and Debugger for Alinous Document CMS, therefore you can use debugger on testing this script.

Server side program for paging

The template with paging also has the server side program as well. In this script, you can handle paging by using "$IN.page" parameter. The parameter is set automatically by the publish engine, therefore you should write program to get data for the page.

The page parameter starts with 0 and ends with [page number] - 1.


Go to Top