|
jforum example source code file (search_pagination.ftl)
The jforum search_pagination.ftl source code
<#function moderationParams>
<#assign params = ""/>
<#if (searchArgs.keywords?size > 0)><#assign params = params +"&search_keywords="+ searchArgs.rawKeywords()/>#if>
<#if (searchArgs.forumId > 0)><#assign params = params +"&search_forum="+ searchArgs.forumId/>#if>
<#if (searchArgs.author > 0)><#assign params = params +"&search_author="+ searchArgs.author/>#if>
<#if (searchArgs.matchType?default("")?length > 0)><#assign params = params +"&match_type="+ searchArgs.matchType/>#if>
<#if (searchArgs.orderDir?default("")?length > 0)><#assign params = params +"&sort_dir="+ searchArgs.orderDir/>#if>
<#if (searchArgs.orderBy?default("")?length > 0)><#assign params = params +"&sort_by="+ searchArgs.orderBy/>#if>
<#return params/>
</#function>
<#macro searchPagination>
<#if (totalRecords > recordsPerPage)>
<#assign baseUrl = contextPath +"/jforum" + extension + "?module=search&action=search"/>
<#assign baseUrl = baseUrl + moderationParams()/>
<div class="pagination">
<#assign link = ""/>
<#-- ------------- -->
<#-- Previous page -->
<#-- ------------- -->
<#if (thisPage > 1)>
<#assign start = (thisPage - 2) * recordsPerPage/>
<a href="${baseUrl}&start=${start}">◄
</#if>
<#if (totalPages > 10)>
<#-- ------------------------------ -->
<#-- Always write the first 3 links -->
<#-- ------------------------------ -->
<#list 1 .. 3 as page>
<@pageLink page, baseUrl/>
</#list>
<#-- ------------------ -->
<#-- Intermediate links -->
<#-- ------------------ -->
<#if (thisPage > 1 && thisPage < totalPages)>
<#if (thisPage > 5)>...#if>
<#if (thisPage > 4)>
<#assign min = thisPage - 1/>
<#else>
<#assign min = 4/>
</#if>
<#if (thisPage < totalPages - 4)>
<#assign max = thisPage + 2/>
<#else>
<#assign max = totalPages - 2/>
</#if>
<#if (max >= min + 1)>
<#list min .. max - 1 as page>
<@pageLink page, baseUrl/>
</#list>
</#if>
<#if (thisPage < totalPages - 4)>...#if>
<#else>
<span class="gensmall">...
</#if>
<#-- ---------------------- -->
<#-- Write the last 3 links -->
<#-- ---------------------- -->
<#list totalPages - 2 .. totalPages as page>
<@pageLink page, baseUrl/>
</#list>
<#else>
<#list 1 .. totalPages as page>
<@pageLink page, baseUrl/>
</#list>
</#if>
<#-- ------------- -->
<#-- Next page -->
<#-- ------------- -->
<#if (thisPage < totalPages)>
<#assign start = thisPage * recordsPerPage/>
<a href="${baseUrl}&start=${start}">►
</#if>
<a href="#goto" onClick="return overlay(this, 'goToBox', 'rightbottom');">${I18n.getMessage("ForumIndex.goToGo")}
<div id="goToBox">
<div class="title">${I18n.getMessage("goToPage")}...Other jforum examples (source code examples)Here is a short list of links related to this jforum search_pagination.ftl source code file: |
| ... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2024 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.