dustin
10 years agoExpert
How to retrieve page number in freemarker?
On the community page, I have created a custom component that lists all of the messages for that board. I am using the default pagination extension and while it allows me to click to any page, the s...
- 10 years ago
I worked out my own answer...
Here is the code that worked for me. The webuisupport.path.parameters.name.get("page") is the key.
<#assign result_count = 25 /> <#if webuisupport.path.parameters.name.get("page") ??> <#assign page_number = webuisupport.path.parameters.name.get("page")?number /> <#assign page_number = page_number - 1 /> <#else> <#assign page_number = 0 /> </#if> <#assign pagination_offset = page_number * result_count /> <#assign recent_messages = rest("2.0","/search?q=" + "SELECT * FROM messages WHERE board.id IN ('${coreNode.id}') AND depth=0 ORDER BY post_time DESC LIMIT ${result_count} OFFSET ${pagination_offset}"?url).data.items />