Monday, November 01, 2010

OpenCMS Paging

Sometime back one of my colleague was looking at how to do paging in OpenCMS. I spent may be 20 minutes doing some google and reading the api docs and here's what I have arrived at.

Dropbox link : http://dl.dropbox.com/u/20544295/opencms_paging.snippet

There is one drawback in the above code. Folder navigation list is retrieved every time. This can be done only once by have the total_size variable stored in session for the first time.

I have to tell you, OpenCMS naming convention is not that good, also the way the functions accept parameters. Looking at the code above, its not easy to figure out what exactly is going on without having the javadoc on the side. Also, why would you want to accept string type values when yo uare expecting numeric values(page number and paging size)? Btw, this was tested on OpenCMS 7.5.3.

If anybody knows how to improve it, please comment.

- yam

No comments: