NAVIGATION
funnelback_classic.ftl
Description
NickScript equivalent tags in FreeMarker.
This library contains a re-implementation of most of the Classic UI tags.
This library must be imported under the s
namespace.
This documentation will give an overview of each tag. For a complete documentation please refer to the main Funnelback documentation.
Some tags takes their parameters from the nested content to mimic the Classic UI tags, for example: <@IfDefCGI>query</@IfDefCGI>
. In that case the input parameter is documented under the Nested heading.
Macro and Function Summary | |
Uncategorized | |
macro
|
|
macro
|
|
macro
|
|
macro
|
|
macro
|
|
macro
|
|
macro
|
|
macro
|
|
macro
|
|
macro
|
|
macro
|
|
macro
|
|
macro
|
|
macro
|
|
macro
|
|
macro
|
|
macro
|
|
macro
|
|
macro
|
|
macro
|
|
macro
|
|
macro
|
|
macro
|
|
macro
|
|
macro
|
|
macro
|
|
macro
|
|
Category Contextual navigation | |
macro
|
|
macro
|
|
macro
|
|
macro
|
|
macro
|
|
macro
|
|
macro
|
|
macro
|
|
macro
|
|
Category Faceted navigation | |
macro
|
|
macro
|
|
function
|
|
macro
|
|
function
|
|
macro
|
|
macro
|
|
macro
|
|
macro
|
|
macro
|
|
macro
|
|
macro
|
|
Macro and Function Detail |
-
macro
AfterSearchOnly
-
Conditional display, content is evaluated only when there are results.
- Source Code
-
<#macro AfterSearchOnly>
<#if (response.resultPacket.resultsSummary.totalMatching)??>
<#nested>
</#if>
</#macro>
-
macro
boldicize
bold
-
Wraps words into strong tags.
- Parameters
bold
- The words to boldicize, space separated. If not set it will automatically boldicize the query terms.
- Source Code
-
<#macro boldicize bold=""><#compress>
<#local content><#nested></#local>
<#if bold != "">
${tagify("strong", bold, content)}
<#else>
<#-- Pass the regular expression returned by PADRE -->
${tagify("strong", response.resultPacket.queryHighlightRegex!, content, true)}
</#if>
</#compress></#macro>
-
macro
Category
max
nbCategories
recursionCategories
tag
name
-
Displays a contextual navigation category or a faceted navigation category.
Note the use of this is ⚠ Deprecated for faceted navigation
The presence of the
name
parameter determines the role.The
nbCategories
andrecursionCategories
parameters are internals and can be safely ignored when using this tag.For faceted navigation the max parameter sets the maximum number of categories to return. If you need to display only a few number of them with a more... link for expansion, you'll need to use Javascript. See the default form file for an example.
- Parameters
max
- Maximum number of categories to display, for faceted navigation.name
- Name of the category for contextual navigation. Can betype
,type
ortopic
. Empty for a faceted navigation category.nbCategories
- (Internal parameter, do not use) Current number of categories displayed (used in recursion for faceted navigation).tag
- HTML tag to wrap faceted navigation categories (defaults to DIV).recursionCategories
- (Internal parameter, do not use) List of categories to process when recursing for faceted navigation).
- Provides
- The category as
${s.category}
. - Category
- Contextual navigation
- Source Code
-
<#macro Category max=16 nbCategories=0 recursionCategories=[] tag="div" name...>
<#--
We use a trick to set the 'name' parameter optional: The argument
is set as an optional multivalued argument. If we don't use that FM
will complain that the 'name' argument must be set.
Using that trick makes the 'name' parameter a Hash, so to access our
initial 'name' argument we must use ${name['name']}
-->
<#if name?? && name?size == 1>
<#list response.resultPacket.contextualNavigation.categories as c>
<#if c.name?? && c.name == name["name"]>
<#assign category = c in s />
<#assign category_hax_next = c_has_next in s />
<#assign category_index = c_index in s />
<#if c.name != "site" || c.clusters?size gt 1>
<#nested>
</#if>
</#if>
</#list>
<#else>
<#-- Find if we are working at the root level (facet) or in a sub category -->
<#if recursionCategories?? && recursionCategories?size gt 0>
<#local categories = recursionCategories />
<#else>
<#local categories = s.facet.categories />
</#if>
<#if categories?? && categories?size gt 0>
<#local class = "category">
<#if name?size gt 0 && name["class"]??>
<#local class = name["class"]>
</#if>
<#list categories as c>
<#assign category = c in s>
<#assign category_hax_next = c_has_next in s />
<#assign category_index = c_index in s />
<#list c.values as cv>
<#-- Find if this category has been selected. If it's the case, don't display it in the list this means
we do not show unselected sibling values of a selected value (this deals with the case a metadata class
has multiple values. -->
<#-- URL Fill is special the single category can be selected yet be required to show unselected
sub paths, that is why in URL mode only we show all non selected values -->
<#if ! question.selectedCategoryValues?keys?seq_contains(urlDecode(cv.queryStringParam?split("=")[0]))
|| (c.queryStringParamName?contains("|url") && !cv.selected)>
<#assign categoryValue = cv in s>
<#assign categoryValue_has_next = cv_has_next in s>
<#assign categoryValue_index = cv_index in s>
<#local nbCategories = nbCategories+1 />
<#if nbCategories gt max><#return></#if>
<#if tag != "">
<${tag} class="${class}">
<#nested>
</${tag}>
<#else>
<#nested>
</#if>
</#if>
</#list>
<#-- Recurse in sub categories -->
<#if category.categories?? && category.categories?size gt 0>
<@Category recursionCategories=category.categories max=max tag=tag nbCategories=nbCategories><#nested></@Category>
</#if>
</#list>
</#if>
</#if>
</#macro>
-
macro
CategoryCount
class
- ⚠ Deprecated: The new facets data model has been simplified and can be used directly with native FreeMarker tags
- Parameters
class
- Optional CSS class.
- Category
- Faceted navigation
- Source Code
-
<#macro CategoryCount class="categoryCount"><#compress>
<#if s.categoryValue??><span class="${class}">${s.categoryValue.count}</span></#if>
</#compress></#macro>
Displays the result count for a facet category value.
-
macro
CategoryName
class
link
extraParams
- ⚠ Deprecated: The new facets data model has been simplified and can be used directly with native FreeMarker tags
- Parameters
link
- Search link to use. Defaults toui.modern.search_link
.extraParams
- Optional extra URL parameters to append to the link. Will be appended as is. Consider using?url
when passing a value.class
- Optional CSS class to use, defaults tocategoryName
.
- Category
- Faceted navigation
- Source Code
-
<#macro CategoryName class="categoryName" link=question.currentProfileConfig.get("ui.modern.search_link") extraParams="">
<#if s.categoryValue??>
<span class="${class}">
<a href="${.namespace.CategoryUrl(link,extraParams)?html}">${s.categoryValue.label?html}</a>
</span>
</#if>
</#macro>
Displays a link for a facet category value.
-
function
CategoryUrl
(
link
,extraParams
)
-
Returns the URL back to the current page with the current category selected. Note that you probabaly want to HTML escape the result.
- Parameters
link
- Search link to use. Defaults toui.modern.search_link
.extraParams
- Optional extra URL parameters to append to the link. Will be appended as is. Consider using?url
when passing a value.
- Category
- Faceted navigation
- Source Code
-
<#function CategoryUrl link=question.currentProfileConfig.get("ui.modern.search_link") extraParams=""><#compress>
<#assign paramName = .namespace.categoryValue.queryStringParam?split("=")[0]>
<#return link + "?" + removeParam(facetScopeRemove(QueryString, paramName), ["start_rank", "duplicate_start_rank", paramName]) + "&" + .namespace.categoryValue.queryStringParam + extraParams />
</#compress></#function>
-
macro
cfg
-
Read a configuration parameter.
Reads a
profile.cfg
with fallback to read acollection.cfg
parameter for the current collection being searched and displays it.- Nested
- Name of the parameter.
- Source Code
-
<#macro cfg><#compress>
<#local key><#nested></#local>
<#if key?? && key != "" && question.currentProfileConfig.get(key)??>
${question.currentProfileConfig.get(key)}
</#if>
</#compress></#macro>
-
macro
cgi
-
Retrieves a cgi parameter value.
- Nested
- Name of the parameter.
- Source Code
-
<#macro cgi><#compress>
<#local key><#nested></#local>
<#if question??
&& question.inputParameters??>
<#-- Return first element only, to mimic Perl UI behavior -->
${question.inputParameters[key]?first!}
</#if>
</#compress></#macro>
-
macro
CheckSpelling
prefix
suffix
-
Displays spelling suggestions.
- Parameters
prefix
- Prefix to display before the suggestion, usually "Did you mean ?".
- Source Code
-
<#macro CheckSpelling prefix="Did you mean:" suffix="?">
<#if question??
&& question.collection??
&& question.currentProfileConfig.get("spelling_enabled")?boolean
&& response??
&& response.resultPacket??
&& response.resultPacket.spell??>
${prefix} <a href="${question.currentProfileConfig.get("ui.modern.search_link")}?${changeParam(QueryString, "query", response.resultPacket.spell.text?url)?html}">
<span class="funnelback-highlight">${response.resultPacket.spell.text}</span></a>${suffix}
</#if>
</#macro>
-
macro
ClusterLayout
-
Conditional display against contextual navigation clusters.
The content will be evaluated only if there are contextual navigation clusters, except if there is only one of the site type.
- Provides
- The contextual navigation object as
${s.contextualNavigation}
. - Category
- Contextual navigation
- Source Code
-
<#macro ClusterLayout>
<#if response??
&& response.resultPacket??
&& response.resultPacket.contextualNavigation??
&& response.resultPacket.contextualNavigation.categories?size gt 0>
<#assign contextualNavigation = response.resultPacket.contextualNavigation in s />
<#if contextualNavigation.categories?size == 1 && contextualNavigation.categories[0].name == "site"
&& contextualNavigation.categories[0].clusters?size < 2>
<#-- Do nothing if we only have a site category with only 1 site -->
<#else>
<#nested>
</#if>
</#if>
</#macro>
-
macro
ClusterNavLayout
-
Displays previously followed clusters.
- Category
- Contextual navigation
- Source Code
-
<#macro ClusterNavLayout>
<#if question?? && question.cnPreviousClusters?size gt 0>
<#nested>
</#if>
</#macro>
-
macro
Clusters
-
Iterates over contextual navigation clusters.
- Provides
- The cluster as
${s.cluster}
. - Category
- Contextual navigation
- Source Code
-
<#macro Clusters>
<#if s.category??>
<#list s.category.clusters as c>
<#assign cluster = c in s />
<#assign cluster_has_next = c_has_next in s />
<#assign cluster_index = c_index in s />
<#nested>
</#list>
</#if>
</#macro>
-
macro
ContextualNavigation
-
Root tag for contextual navigation.
The content is always evaluated, regardless of the presence of contextual navigation suggestions.
- Category
- Contextual navigation
- Source Code
-
<#macro ContextualNavigation>
<#nested>
</#macro>
-
macro
ContextualNavigationNav
-
Iterates overs previously followed clusters.
- Provides
- The previous cluster as
${s.previousCluster}
. - Category
- Contextual navigation
- Source Code
-
<#macro ContextualNavigationNav>
<#if question?? && question.cnPreviousClusters?size gt 0>
<#list question.cnPreviousClusters as cluster>
<#assign previousCluster = cluster in s>
<#assign previousCluster_index = cluster_index in s>
<#assign previousCluster_has_next = cluster_has_next in s>
<#nested>
</#list>
</#if>
</#macro>
-
macro
CurrentDate
-
Displays the current date and time.
- Source Code
-
<#macro CurrentDate><p class="date">${currentDate()?datetime?string["MMM d, yyyy h:mm:ss aa"]}</p></#macro>
-
macro
cut
cut
-
Cut the left part of a string if it matches the given pattern.
- Parameters
cut
- Pattern to look for.
- Source Code
-
<#macro cut cut><#compress>
<#if cut??>
<#local value><#nested></#local>
${value?replace("^"+cut, "", "r")}
</#if>
</#compress></#macro>
-
macro
Date
prefix
-
Displays the last updated date of the collection being searched.
- Parameters
prefix
- Optional prefix to output before the date.
- Source Code
-
<#macro Date prefix=""><#compress>
<#if question?? && question.collection??>
<#local updDate = updatedDate(question.collection.id)!"">
<#if updDate?is_date>
${prefix}${updatedDate(question.collection.id)?datetime?string}
<#else>
${prefix}Meta colllection
</#if>
</#if>
</#compress></#macro>
-
macro
Explore
label
-
Generates an "explore" link for a search result.
- Parameters
label
- Label to use for the link.
- Source Code
-
<#macro Explore label="Explore">
<a class="search-explore" href="?collection=${question.collection.id}&profile=${question.profile}&form=${question.form}&query=explore:${s.result.liveUrl?url?html}">${label}</a>
</#macro>
-
macro
Facet
name
names
orderedNames
class
- ⚠ Deprecated: The new facets data model has been simplified and can be used directly with native FreeMarker tags
- Parameters
names
- A list of specific facets to display, optional. Won't affect facet display order (defined infaceted_navigation.cfg
).name
- Name of a specific facet to display, optional.orderedNames
- A list of specific facets to display, in the order they are to be displayed optional.class
- CSS class to use on the DIV containing each facet, defaults tofacet
.
- Provides
- The facet as
${s.facet}
. - Category
- Faceted navigation
- Source Code
-
<#macro Facet name="" names=[] orderedNames=[] class="facet">
<#if response?? && response.facets??>
<#if name == "" && names?size == 0 && orderedNames?size == 0>
<#-- Iterate over all facets -->
<#list response.facets as f>
<#if f.hasValues() || question.selectedFacets?seq_contains(f.name)>
<#assign facet = f in s>
<#assign facet_index = f_index in s>
<#assign facet_has_next = f_has_next in s>
<div id="facet-${facet_index}" class="${class}">
<#nested>
</div>
</#if>
</#list>
<#else>
<#if orderedNames?size == 0>
<#list response.facets as f>
<#if (f.name == name || names?seq_contains(f.name) ) && (f.hasValues() || question.selectedFacets?seq_contains(f.name))>
<#assign facet = f in s>
<#assign facet_index = f_index in s>
<#assign facet_has_next = f_has_next in s>
<div class="${class}">
<#nested>
</div>
</#if>
</#list>
<#else>
<#list orderedNames as orderedName>
<#list response.facets as f>
<#if (f.name == orderedName) && (f.hasValues() || question.selectedFacets?seq_contains(f.name))>
<#assign facet = f in s>
<#assign facet_index = f_index in s>
<#assign facet_has_next = f_has_next in s>
<div class="${class}">
<#nested>
</div>
</#if>
</#list>
</#list>
</#if>
</#if>
</#if>
</#macro>
Displays a facet, a list of facets, or all facets.
If both name
and names
are not set this tag iterates over all the facets.
-
function
FacetAllUrl
(
facetDef
,link
)
-
- Category
- Faceted navigation
- Source Code
-
<#function FacetAllUrl facetDef link=question.currentProfileConfig.get("ui.modern.search_link")>
<#return link + "?" + removeParam(facetScopeRemove(QueryString, facetDef.allQueryStringParamNames), ["start_rank","duplicate_start_rank"] + facetDef.allQueryStringParamNames) />
</#function>
-
macro
FacetBreadCrumb
categoryDefinitions
selectedCategoryValues
separator
- ⚠ Deprecated: The new facets data model has been simplified and can be used directly with native FreeMarker tags
- Parameters
categoryDefinitions
- List of sub categories (hierarchical).separator
- Separator to use in the breadcrumb.selectedCategoryValues
- List of selected values.
- Category
- Faceted navigation
- Source Code
-
<#macro FacetBreadCrumb categoryDefinitions selectedCategoryValues separator>
<#list categoryDefinitions as def>
<#if def.class.simpleName == "URLFill" && selectedCategoryValues?keys?seq_contains(def.queryStringParamName)>
<#-- Special case for URLFill facets: Split on slashes -->
<#assign path = selectedCategoryValues[def.queryStringParamName][0]>
<#assign pathBuilding = "">
<#list path?split("/", "r") as part>
<#assign pathBuilding = pathBuilding + "/" + part>
<#-- Don't display bread crumb for parts that are part
of the root URL -->
<#if ! def.data?lower_case?matches(".*[/\\\\]"+part?lower_case+"[/\\\\].*")>
<#-- part needs to be url-decoded to be displayed nicely
e.g. "with spaces" rather than "with%20spaces" -->
<#if part_has_next>
${separator} <a href="${question.currentProfileConfig.get("ui.modern.search_link")}?${removeParam(facetScopeRemove(QueryString, def.allQueryStringParamNames), ["start_rank","duplicate_start_rank"] + def.allQueryStringParamNames)?html}&${def.queryStringParamName?url}=${pathBuilding?url}">${urlDecode(part)?html}</a>
<#else>
${separator} ${urlDecode(part)?html}
</#if>
</#if>
</#list>
<#else>
<#if selectedCategoryValues?keys?seq_contains(def.queryStringParamName)>
<#-- Find the label for this category. For nearly all categories the label is equal
to the value returned by the query processor, but not for date counts for example.
With date counts the label is the actual year "2003" or a "past 3 weeks" but the
value is the constraint to apply like "d=2003" or "d>12Jun2012" -->
<#-- Use value by default if we can't find a label -->
<#local valueLabel = selectedCategoryValues[def.queryStringParamName][0] />
<#-- Iterate over generated facets -->
<#list response.facets as facet>
<#if def.facetName == facet.name>
<#-- Facet located, find current working category -->
<#assign fCat = facet.findDeepestCategory([def.queryStringParamName])!"" />
<#if fCat != "">
<#list fCat.values as catValue>
<#-- Find the category value for which the query string param
matches the currently selected value -->
<#local kv = catValue.queryStringParam?split("=") />
<#if valueLabel == urlDecode(kv[1])>
<#local valueLabel = catValue.label />
</#if>
</#list>
</#if>
</#if>
</#list>
<#-- Find if we are processing the last selected value (leaf node) -->
<#local last = true>
<#list def.allQueryStringParamNames as param>
<#if param != def.queryStringParamName && selectedCategoryValues?keys?seq_contains(param)>
<#local last = false>
<#break>
</#if>
</#list>
<#if last == true>
${separator} ${valueLabel?html}
<#else>
${separator} <a href="${question.currentProfileConfig.get("ui.modern.search_link")}?${removeParam(facetScopeRemove(QueryString, def.allQueryStringParamNames), ["start_rank","duplicate_start_rank"] + def.allQueryStringParamNames)?html}&${def.queryStringParamName}=${selectedCategoryValues[def.queryStringParamName][0]?url}">
${valueLabel?html}
</a>
<@FacetBreadCrumb categoryDefinitions=def.subCategories selectedCategoryValues=selectedCategoryValues separator=separator/>
</#if>
<#-- We've displayed one step in the breadcrumb, no need to inspect
other category definitions -->
<#break />
</#if>
</#if>
</#list>
</#macro>
Recursively generates the breadcrumbs for a facet.
-
macro
FacetedSearch
negate
-
Conditional display against faceted navigation.
The content will be evaluated only if faceted navigation is configured.
- Parameters
negate
- Whether to negate the tag, i.e. evaluate the content if faceted navigation is not configured.
- Category
- Faceted navigation
- Source Code
-
<#macro FacetedSearch negate=false>
<#if !negate>
<#if question??
&& facetedNavigationConfig(question.collection, question.profile)?? >
<#nested>
</#if>
<#else>
<#if !question??
|| !facetedNavigationConfig(question.collection, question.profile)?? >
<#nested>
</#if>
</#if>
</#macro>
-
macro
FacetLabel
class
separator
summary
tag
link
- ⚠ Deprecated: The new facets data model has been simplified and can be used directly with native FreeMarker tags
- Parameters
summary
- Set to true if you want this tag to display the summary + breadcrumb, otherwise use<@s.FacetSummary />
.tag
- HTML tag to wrap the name and summaryclass
- Optional class to affect to the div containing the facet and breadcrumb.separator
- Separator to use in the breadcrumb.
- Category
- Faceted navigation
- Source Code
-
<#macro FacetLabel class="facetLabel" separator="→" summary=true tag="div" link=question.currentProfileConfig.get("ui.modern.search_link")>
<#local fn = facetedNavigationConfig(question.collection, question.profile) >
<#if fn??>
<#-- Find facet definition in the configuration corresponding
to the facet we're currently displaying -->
<#list fn.facetDefinitions as fdef>
<#if fdef.name == s.facet.name>
<#assign facetDef = fdef in s />
<#assign facetDef_index = fdef_index in s />
<#assign facetDef_has_next = fdef_has_next in s />
<${tag} class="${class}"> ${s.facet.name}
<#if summary><@FacetSummary separator=separator alltext="all" link=link /></#if>
</${tag}>
</#if>
</#list>
</#if>
</#macro>
Displays a facet label and a breadcrumb.
-
macro
FacetScope
input
-
Display the facet scope checkbox.
Provides a checkbox to constraint search to the currently selected facet(s) only.
- Nested
- Text to display beside the checkbox.
- Category
- Faceted navigation
- Source Code
-
<#macro FacetScope input=true><#compress>
<@AfterSearchOnly>
<#if question?? && question.selectedCategoryValues?size gt 0>
<#local facetScope = "" />
<#list question.selectedCategoryValues?keys as key>
<#list question.selectedCategoryValues[key] as value>
<#local facetScope = facetScope + key?url+"="+value?url />
<#if value_has_next><#local facetScope = facetScope + "&" /></#if>
</#list>
<#if key_has_next><#local facetScope = facetScope + "&" /></#if>
</#list>
<#if input>
<input type="checkbox" name="facetScope" id="facetScope" value="${facetScope}" checked="checked">
<label for="facetScope"><#nested></label>
<#else>
${facetScope}
</#if>
</#if>
</@AfterSearchOnly>
</#compress></#macro>
-
macro
FacetSummary
separator
alltext
link
- ⚠ Deprecated: The new facets data model has been simplified and can be used directly with native FreeMarker tags
- Parameters
separator
- Separator to use in the breadcrumb.alltext
- Text to use to completely remove the facet constraints. Defaults to "all".
- Category
- Faceted navigation
- Source Code
-
<#macro FacetSummary separator="→" alltext="all" link=question.currentProfileConfig.get("ui.modern.search_link")>
<#-- We must test various combinations here as different browsers will encode
some characters differently (i.e. '/' will sometimes be preserved, sometimes
encoded as '%2F' -->
<#if QueryString?contains("f." + facetDef.name?url)
|| urlDecode(QueryString)?contains("f." + facetDef.name)
|| urlDecode(QueryString)?contains("f." + facetDef.name?url)>
: <a href="${.namespace.FacetAllUrl(facetDef, link)?html}">${alltext}</a>
</#if>
<@FacetBreadCrumb categoryDefinitions=facetDef.categoryDefinitions selectedCategoryValues=question.selectedCategoryValues separator=separator />
</#macro>
Displays The facet summary and breadcrumb.
This tag is called by <@s.FacetLabel />
but this can be disabled so that the summary and breadcrumb can be displayed separately using this tag for more flexibility.
-
macro
FormChoice
-
Provide links to collection search forms.
This will iterate over every existing search forms for the current collection and display a link to access every one of them.
- Source Code
-
<#macro FormChoice>
<#if question?? && question.collection??>
<#assign forms = formList(question.collection.id, question.profile) />
<#assign url = question.currentProfileConfig.get("ui.modern.search_link")
+ "?collection=" + question.collection.id
+ "&profile=" + question.profile />
<#list forms as form>
<#if form != question.form && !form?matches("^.*-\\d{12}$")>
<a href="${url}&form=${form}">${form}</a>
</#if>
</#list>
</#if>
</#macro>
-
macro
HtmlDecode
-
Decodes a String from HTML.
- Nested
- Content to decode.
- Source Code
-
<#macro HtmlDecode><#compress>
<#assign content><#nested></#assign>
${htmlDecode(content)}
</#compress></#macro>
-
macro
IfDefCGI
name
-
Conditional display against CGI parameters (Query string).
The nested content will be evaluated only if the desired parameter exists.
- Parameters
name
- Name of the parameter to test.
- Source Code
-
<#macro IfDefCGI name><#compress>
<#if question??
&& question.inputParameters??
&& question.inputParameters?keys?seq_contains(name)>
<#nested>
</#if>
</#compress></#macro>
-
macro
IfNotDefCGI
name
-
Conditional display against CGI parameters (Query string).
The nested content will be evaluated only if the desired parameter is not set.
- Parameters
name
- Name of the parameter to test.
- Source Code
-
<#macro IfNotDefCGI name><#compress>
<#if question??
&& question.inputParameters??
&& question.inputParameters?keys?seq_contains(name)>
<#else>
<#nested>
</#if>
</#compress></#macro>
-
macro
InitialFormOnly
-
Conditional display, content is evaluated only when there is no search.
- Source Code
-
<#macro InitialFormOnly><#compress>
<#if (response.resultPacket.resultsSummary.totalMatching)??>
<#else>
<#nested>
</#if>
</#compress></#macro>
-
macro
italicize
italics
-
Wraps words into emphasis tags.
- Parameters
italics
- The words to italicize, space separated. If not set it will automatically italicize the query terms.
- Source Code
-
<#macro italicize italics=""><#compress>
<#local content><#nested></#local>
<#if italics != "">
${tagify("em", italics, content)}
<#else>
<#-- Pass the regular expression returned by PADRE -->
${tagify("em", response.resultPacket.queryHighlightRegex!, content, true)}
</#if>
</#compress></#macro>
-
macro
MoreOrLessCategories
- ⚠ Deprecated: The new facets data model has been simplified and can be used directly with native FreeMarker tags
- Category
- Faceted navigation
- Source Code
-
<#macro MoreOrLessCategories>
<span class="moreOrLessCategories"><a href="#" onclick="javascript:toggleCategories(this)" style="display: none;">more...</a></span>
</#macro>
Displays a link to show more or less categories for a facet.
-
macro
NoClustersFound
-
Conditional display against the presence of clusters.
The content will be evaluated only if contextual navigation clusters were found.
- Category
- Contextual navigation
- Source Code
-
<#macro NoClustersFound>
<#if response??
&& response.resultPacket??
&& (! response.resultPacket.contextualNavigation??
|| response.resultPacket.contextualNavigation.categories?size == 0)>
<#nested>
</#if>
</#macro>
-
macro
OpenSearch
-
Generates an Open Search link.
- Source Code
-
<#macro OpenSearch>
<#local title><#nested></#local>
<#if ! title?? || title == "">
<#local title = "Search " + question.currentProfileConfig.get("service_name") />
</#if>
<link rel="search" type="application/opensearchdescription+xml" href="open-search.xml?${QueryString?html}" title="${title}">
</#macro>
-
macro
PrevNext
label
separator
next_prev_prefix
next_prev_suffix
prevLabel
nextLabel
numPages
-
Generates previous / next navigation links, and page shortcuts.
- Parameters
numPages
- Number of pages links to display (default = 10)next_prev_prefix
- Text placed before the Next and Previous links.prevLabel
- Label to use for "previous"nextLabel
- Label to use for "next"next_prev_suffix
- Text placed after the Next and Previous links.label
- Label to be placed at the beginning of the page list.separator
- Text to placed between the page links.
- Nested
- Any HTML attributes to include in the a tag.
- Source Code
-
<#macro PrevNext label="" separator=" " next_prev_prefix=" [ " next_prev_suffix=" ] " prevLabel="Prev" nextLabel="Next" numPages=10>
<#if response?? && response.resultPacket?? && response.resultPacket.resultsSummary??>
<#local rs = response.resultPacket.resultsSummary />
${label!""}
<#-- PREVIOUS link -->
<#if rs.prevStart??>
<#local url = question.currentProfileConfig.get("ui.modern.search_link") + "?" />
<#local url = url + changeParam(QueryString, "start_rank", rs.prevStart) />
${next_prev_prefix}<a href="${url?html}" rel="prev" class="fb-previous-result-page fb-page-nav" <#nested>>${prevLabel} ${rs.numRanks}</a>${next_prev_suffix}
</#if>
<#local pages = 0 />
<#if rs.fullyMatching??>
<#if rs.fullyMatching gt 0>
<#local pages = (rs.fullyMatching + rs.partiallyMatching + rs.numRanks - 1) / rs.numRanks />
<#else>
<#local pages = (rs.totalMatching + rs.numRanks - 1) / rs.numRanks />
</#if>
<#else>
<#-- Event search -->
<#local pages = (rs.totalMatching + rs.numRanks - 1) / rs.numRanks />
</#if>
<#local currentPage = 1 />
<#if rs.currStart gt 0 && rs.numRanks gt 0>
<#local currentPage = (rs.currStart + rs.numRanks -1) / rs.numRanks />
</#if>
<#local firstPage = 1 />
<#if currentPage gt ((numPages-1)/2)?floor>
<#local firstPage = currentPage - ((numPages-1)/2)?floor />
</#if>
<#list firstPage..firstPage+(numPages-1) as pg>
<#if pg gt pages><#break /></#if>
<#if pg == currentPage>
<span class="fb-current-result-page">${pg}</span>
<#else>
<#local url = question.currentProfileConfig.get("ui.modern.search_link") + "?" />
<#local url = url + changeParam(QueryString, "start_rank", (pg-1) * rs.numRanks+1) />
<a href="${url?html}" <#nested>>${pg}</a>
</#if>
<#if pg_has_next> ${separator} </#if>
</#list>
<#-- NEXT link -->
<#if rs.nextStart??>
<#local url = question.currentProfileConfig.get("ui.modern.search_link") + "?" />
<#local url = url + changeParam(QueryString, "start_rank", rs.nextStart) />
${next_prev_prefix}<a href="${url?html}" rel="next" class="fb-next-result-page fb-page-nav" <#nested>>${nextLabel} ${rs.numRanks}</a>${next_prev_suffix}
</#if>
</#if>
</#macro>
-
macro
QueryClean
-
Displays the cleaned query.
The cleaned query contains only query expressions entered by the user, without the one dynamically generated for other purposes like faceted navigation.
- Source Code
-
<#macro QueryClean><#compress>
<#if response??
&& response.resultPacket??>
${response.resultPacket.queryCleaned!?html}
</#if>
</#compress></#macro>
-
macro
Quicklinks
-
Conditional display against quick links.
The content will be evaluated only if the current result has quick links.
- Source Code
-
<#macro Quicklinks>
<#if s.result.quickLinks??>
<#nested>
</#if>
</#macro>
-
macro
QuickRepeat
-
Iterates over quick links.
The content will be evaluated once per quick link.
- Provides
- The quick link as
${s.ql}
. - Source Code
-
<#macro QuickRepeat>
<#if s.result.quickLinks?? && s.result.quickLinks.quickLinks??>
<#list s.result.quickLinks.quickLinks as quickLink>
<#assign ql = quickLink in s />
<#assign ql_index = quickLink_index in s />
<#assign ql_has_next = quickLink_has_next in s />
<#nested>
</#list>
</#if>
</#macro>
-
macro
Results
-
Conditional display against results and results looping.
The content will be evaluated only if there are results, and once per result found.
Note: This will loop over a list containing a list of TierBar and Result objects, so you need to check the object type in the loop before trying to access its fields like title, etc.
- Provides
- the search results as
${s.result}
. - Source Code
-
<#macro Results>
<#if response??
&& response.resultPacket??
&& response.resultPacket.resultsWithTierBars??>
<#list response.resultPacket.resultsWithTierBars as r>
<#assign result = r in s />
<#assign result_has_next = r_has_next in s />
<#assign result_index = r_index in s />
<#nested>
</#list>
</#if>
</#macro>
-
macro
rss
-
Generates a RSS link or button for the current query.
- Source Code
-
<#macro rss>
<#assign type><#nested></#assign>
<#if type??>
<#if type == "link">
<link rel="alternate" type="application/rss+xml" title="Search results" href="${SearchPrefix}rss.cgi?${QueryString!""}" />
</#if>
<#if type == "button">
<p id="rss-button"><a href="${SearchPrefix}rss.cgi?${QueryString!""}" class="rss">
<span class="rss-left"> XML </span><span class="rss-right">RSS 2.0</span>
</a></p>
</#if>
</#if>
</#macro>
-
macro
Select
name
options
range
defaultValue
additional
-
Generates a HTML
<select />
tags with options.- Parameters
defaultValue
- Default value to set when there's no CGI value.additional
- Any additional HTML attributes to set to the select tag (e.g.<@s.Select ... class="..." onchange="..." />
)name
- Name of the select.options
- List of option, either single strings that will be used as the name and value, orvalue=label
strings.range
- Optional range expression to generate options.
- Source Code
-
<#macro Select name options=[] range="" defaultValue="" additional...>
<#assign selectedValue = defaultValue />
<#if question.inputParameters[name]?first! != "">
<#assign selectedValue = question.inputParameters[name]?first! />
</#if>
<select name="${name}" <#compress>
<#if additional?? && additional?is_hash>
<#list additional?keys as key>${key}="${additional[key]}" </#list>
</#if>
</#compress>>
<#if options?size gt 0>
<#list options as opt>
<#if opt?contains("=")>
<#assign valueAndLabel = opt?split("=")>
<option value="${parseRelativeDate(valueAndLabel[0])}" <#if selectedValue == valueAndLabel[0]>selected="selected"</#if>>${valueAndLabel[1]}</option>
<#else>
<option value="${parseRelativeDate(opt)}" <#if selectedValue == opt>selected="selected"</#if>>${parseRelativeDate(opt)}</option>
</#if>
</#list>
</#if>
<#if range != "">
<#assign parsedRange = parseRange(range) />
<#list parsedRange.start..parsedRange.end as i>
<option value="${i?c}" <#if question.inputParameters[name]?first?? && question.inputParameters[name]?first == i?c>selected="selected"</#if>>${i?c}</option>
</#list>
</#if>
</select>
</#macro>
-
macro
ShortFacetLabel
title
class
- ⚠ Deprecated: The new facets data model has been simplified and can be used directly with native FreeMarker tags
- Parameters
title
- Whether to display the facet title only, or the category.class
- CSS class to apply to the container DIV,shortFacetLabel
by default.
- Category
- Faceted navigation
- Source Code
-
<#macro ShortFacetLabel title=false class="shortFacetLabel">
<#if (title?is_boolean && title) || (title?is_string && title == "true")>
<div class="${class}">${s.facet.name!""}</div>
<#else>
<#local deepest = s.facet.findDeepestCategory(question.selectedCategoryValues?keys)!"">
<#if deepest != "">
<div class="${class}">${question.selectedCategoryValues[deepest.queryStringParamName]?first}</div>
<#else>
<div class="${class}">${s.facet.name!""}</div>
</#if>
</#if>
</#macro>
Displays facet title or value of the current category.
Displays either the facet title if no categories has been selected, or the value of the currently selected category.
For hierarchical facets, displays the latest selected category.
-
macro
ShowFewerClusters
category
-
Link to show less clusters.
- Parameters
category
- Name of the category for contextual navigation (type
,site
,topic
).
- Category
- Contextual navigation
- Source Code
-
<#macro ShowFewerClusters category>
<#if s.category?? && s.category.name == category && s.category.fewerLink??>
<#nested>
</#if>
</#macro>
-
macro
ShowMoreClusters
category
-
Link to show more clusters.
- Parameters
category
- Name of the category for contextual navigation (type
,site
,topic
).
- Category
- Contextual navigation
- Source Code
-
<#macro ShowMoreClusters category>
<#if s.category?? && s.category.name == category && s.category.moreLink??>
<#nested>
</#if>
</#macro>
-
macro
Truncate
length
-
Truncate a string on word boundaries.
- Parameters
length
- Length to keep.
- Source Code
-
<#macro Truncate length><#compress>
<#local value><#nested></#local>
${truncate(value, length)}
</#compress></#macro>
-
macro
TruncateHTML
length
-
Truncate a string on word boundaries.
If the string contains HTML it'll try to preserve its validity.
- Parameters
length
- Length to keep.
- Source Code
-
<#macro TruncateHTML length><#compress>
<#local value><#nested></#local>
${truncateHTML(value, length)}
</#compress></#macro>
-
macro
TruncateURL
length
-
Truncate an URL in a sensible way.
This tag will attempt to break the URL up over maximum of two lines, only breaking on slashes.
- Parameters
length
- Length to keep.
- Source Code
-
<#macro TruncateURL length><#compress>
<#local value><#nested></#local>
${truncateURL(value, length)}
</#compress></#macro>
-
macro
URLEncode
-
Encodes a String in URL format.
- Nested
- Content to encode.
- Source Code
-
<#macro URLEncode><#compress>
<#assign content><#nested></#assign>
${content?url}
</#compress></#macro>