SearchResultsPageList
test a search results PageList based on a Page List Template
This test page looks at issues with the #searchresults pagelist defined below
- why does the pagelist return values even before the search?
- why, when the searchbox is used does the page not show the #searchresults pagelist?
- from a similar example here where
{$$PageListCount}is not showing
(:searchbox target={$FullName} :)
|
>>comment<<
[[#searchresults]]
(:template defaults request=-group req=1 order=$Name name={$:ExcludePages} list=normal:)
(:template first:)
----
!!! [[{$$group}/ | {$$fromgrp}]]
(:details summary="Show {$$PageListCount} search results from {$$fromgrp}":)
(:template each:)
(:if equal "{=$Title}" "Home Page":)
* [[{=$FullName} | {=$Groupspaced}]] [- {=$:Summary}-] [--(E={$$EachCount} P={$$PageCount} G={$$GroupCount} GP={$$GroupPageCount} PL={$$PageListCount})--]
(:else:)
* [[{=$FullName} | {=$Titlespaced}]] [- {=$:Summary}-] [--(E={$$EachCount} P={$$PageCount} G={$$GroupCount} GP={$$GroupPageCount} PL={$$PageListCount})--]
(:ifend:)
(:template last:)
(:detailsend:)
(:template none:)
No results found
[[#searchresultsend]]
>><<
|
(:pagelist group=PmWiki fmt=#searchresults fromgrp="the PM wiki pages" count=10:) |
the PM wiki pagesShow 311 search results from the PM wiki pages
|
req=1
The req=1 parameter requires that search terms be posted (that is, that the user presses "search" on a search form, or follows a link with additional parameters like [[Page?q=terms&order=-name]]) before the pagelist is executed. Note that (:pagelist request=1 req=1:) works mostly like (:searchresults:) without the lines "Results of search for ..." and "X pages found out of Y pages searched". Both "request=1" and "req=1" are needed.
When a search is performed, either via a searchbox directive, or via the search form of the skin, if the page contains a "searchresults" directive, that page will be used to display the results of the search; if the page doesn't have a "searchresults" directive, the page Site.Search will be used to display the results.
request=
With (:pagelist [other parameters] request=1:) you can override most pagelist parameters, by providing request parameters in the URL.
For example, (:pagelist order=name request=1:) will normally sort the list by name. But if the page's URL contains ?order=time, the list will be sorted by time. If the URL contains ?order=, the list will be unordered. Note: In the URL, encode any "#"s that are in your parameters as "%23". Since this parameter gives users who don't have edit rights the ability to run a pagelist of their choosing, consider its security implications for your website before using it.
Since version 2.2.71, it is possible to explicitly allow only certain parameters that can be overridden, or to disallow some parameters to be overridden. If you need this, instead of 1, enter the parameter names.
Allow all parameters to be overridden:(:pagelist request=1:)Allow only 'order' and 'count' parameters to be overridden:
(:pagelist request=order,count:)Allow all parameters to be overridden, except 'fmt' and 'trail', note the "minus" sign before each forbidden parameter:
(:pagelist request=-fmt,-trail:)