Skip to content

Commit

Permalink
Item3931: pagerformat docco - next up I need to work out how to expla…
Browse files Browse the repository at this point in the history
…in the 'built in pager system' and make a few examples

git-svn-id: http://svn.foswiki.org/trunk@7050 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
SvenDowideit authored and SvenDowideit committed Apr 2, 2010
1 parent 3fb9a42 commit b0a57cf
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
27 changes: 26 additions & 1 deletion core/data/System/FormattedSearch.txt
Expand Up @@ -21,6 +21,9 @@ Format tokens that can be used in the header string:

| *Name:* | *Expands To:* |
| =$web= | Name of the web |
| =$ntopics= | Number of topics found in current web. Will be 0 (zero). |
| =$nhits= | Number of hits if =multiple="on"=. Will be 0 (zero). |
| =$pager= | pager control - can be optionally customised using the =pagerformat= below |
%INCLUDE{FormatTokens}%

---+++ 2. =footer="..."= parameter
Expand All @@ -33,9 +36,30 @@ Format tokens that can be used in the footer string:
| =$web= | Name of the web |
| =$ntopics= | Number of topics found in current web |
| =$nhits= | Number of hits if =multiple="on"=. Cumulative across all topics in current web. Identical to =$ntopics= unless =multiple="on"= |
| =$pager= | pager control - can be optionally customised using the =pagerformat= below |
%INCLUDE{FormatTokens}%

---+++ 3. =format="..."= parameter
---+++ 3. =pagerformat="..."= parameter

Use the pagerformat parameter to customise the appearance of the paging control.
It should correspond to the format of the format parameter.
This parameter is optional. <br /> Example: =pagerformat="Page $showpage of $numberofpages [[$nexturl][next page]]"=

Format tokens that can be used in the pagerformat string:

| *Name:* | *Expands To:* |
| =$previouspage= | The page number before the currently displayed one |
| =$currentpage= | The currently displayed page number |
| =$nextpage= | The page number after the currently displayed one |
| =$numberofpages= | Total number of pages there are results for |
| =$pagesize= | The number of results per page |
| =$previousurl= | full URL to the previous page - _IF_ using the built in pager system |
| =$nexturl= | full URL to the previous page - _IF_ using the built in pager system |
| =$previousbutton= | skin template (SEARCH:pager_previous) html for the full URL to the previous page - _IF_ using the built in pager system |
| =$nextbutton= | skin template (SEARCH:pager_next) html for the full URL to the previous page - _IF_ using the built in pager system |
%INCLUDE{FormatTokens}%

---+++ 4. =format="..."= parameter

Use the format parameter to specify the format of one search hit.
<br /> Example: =format="| $topic | $summary |"=
Expand Down Expand Up @@ -79,6 +103,7 @@ Format tokens that can be used in the format string:
| =$count(reg-exp)= | Count of number of times a regular expression pattern appears in the text of a topic (does not search meta data). Follows guidelines for use and limitations outlined above under =$pattern(reg-exp)=. Example: =$count(.*?(---[+][+][+][+]) .*)= counts the number of &lt;H4&gt; headers in a page. |
| =$ntopics= | Number of topics found in current web. This is the current topic count, not the total number of topics |
| =$nhits= | Number of hits if =multiple="on"=. Cumulative across all topics in current web. Identical to =$ntopics= unless =multiple="on"= |
| =$pager= | pager control - can be optionally customised using the =pagerformat= below |
%INCLUDE{FormatTokens}%

---++ Examples
Expand Down
1 change: 1 addition & 0 deletions core/lib/Foswiki/Search.pm
Expand Up @@ -621,6 +621,7 @@ sub formatResults {
#TODO: need to ask the result set
my $numberofpages = $infoCache->numberOfTopics / $params->{pagesize};
$numberofpages = int($numberofpages)+1;
#TODO: excuse me?
my $sep = ' ';

my $nextidx = $showpage + 1;
Expand Down

0 comments on commit b0a57cf

Please sign in to comment.