ShowNext Context [ShowNext Parameters]<a href="..">[/ShowNext]
Creates a list of hyperlinks or buttons that display more found items.

To display a list of hyperlinks displaying more items found in a search, place one or more [ShowNext] contexts inside a [Search] context. This context is only valid inside a [Search] context, and will only be used if the search specified a max=N, and the number of found items is greater than max.

Example (normally you would put the following text into a .tpl file on your server and use a web browser to link to it):

[ShowNext position=begin]
<a href="SearchResults.tpl?command=search&[SearchString]">Show items [start]-[end]</a><br>
[/ShowNext]
 
[foundItems]
[/foundItems]
 
[ShowNext position=end]
<a href="SearchResults.tpl?command=search&[SearchString]">Show items [start]-[end]</a><br>
[/ShowNext]

If a search returns 50 found items, and max is set to 10, then [ShowNext] loops through all the "chunks" of 10 necessary to create hyperlinks for each set of 10 items not displayed inside the [FoundItems] loop:

 
Show Items 1-10 (this comes from position=begin)
Show Items 11-20
(Items 21-30 are displayed) (this comes from [foundItems]
Show Items 31-40 (this comes from position=end)
Show Items 41-50

The following parameters can be used to modify the [ShowNext] context:
 Parameter  Description
position
Optional, one of
  • Begin - loop through "chunks" of indices preceding the ones displayed inside the [foundItems] loop.
  • Middle - Display range of indices that are inside [foundItems] loop (rarely, if ever, used).
  • End - loop through "chunks" of indices after the ones displayed inside the [foundItems] loop.
If no position is specified, the default is to loop through both begin and end "chunks", thus displaying all possible "Show Next" hyperlinks.
 method
Optional, one of
  • GET - [SearchString] displays HREF-style (hyperlink) parameters for the search.
  • POST - [SearchString] displays FORM METHOD=POST style parameters for the search. Use this only if your search is so complex it requires more than 255 characters worth of search parameters.
If no method is specified, then "GET" is assumed, which means that HREF-style links are generated.
max
Optional, maximum number of "Next" links to show at one time. Useful if you want to simply show a single "More" button, rather than showing a long list of "Show 1-10," "Show 11-20," etc. links.

The following tags are available inside a [ShowNext] context:
Tag Description
 [SearchString]
All search parameters necessary to find this "chunk" of items in the range [Start] - [End].
[Start]
A number indicating the index position of the first item that will be displayed in this range of found items.
[End]
A number indicating the index position of the last item that will be displayed in this range of found items.

User Contributed Notes
ShowNextContext  

GK - gary at garykrockover dot com 
04/25/2003 at 14:47:15
Snippet: [ShowNext] replacement.  This will show your next links in the format of Page 1 | 2 | 3 etc and can be used even when the page isn't a results page from a [Search] command:

[search db=YOURDATABSE.DB&eqSEARCH_CRITERIAdatarq=SOMETHING]
[text show=f]dividerA=[math]ceil([numfound]/25)[/math][/text]
Page:
[Loop start=1&end=[dividerA]]
<a href="YOUR_RESULTS_PAGE.html?startnum=[math]([index]*25)-24[/math]">[index]</a> |
[/Loop]
[/search]

This example breaks down the results pages into lists of 25 results per page. Substitute for the 25 in all places as needed, subtract one number from the one you use to get the last digit in this formula: ?startnum=[math]([index]*25)-24[/math]

On YOUR_RESULTS_PAGE, you will have the actual search and add this to your query: &max=25&startat=[startnum]. Again substituting the 25 with a digit of your choosing for how many results you want per page.

Govinda - govinda dot webdnatalk at gmail dot com 
05/12/2009 at 15:28:13
filling our Gary's code a little more to make it look closer to what we get with [shownext] links.

[!]---START Gary Krockover's shownext replacement---[/!]
[!]---This all goes inside your [search] context--[/!]
[text show=F]max2find=2[/text][!]<----change this # to how many you want in each "chunk"[/!]
[text show=f]dividerA=[math]ceil([numfound]/[max2find])[/math][/text]
[Loop start=1&end=[dividerA]]
<a href="[thisurl]?startnum=[math show=T]([index]*[max2find])-([max2find]-1)[/math][FormVariables][hideif [URL][name][/URL]=startnum]&[name]=[value][/hideif][/FormVariables]">[math show=T]GarysStarter=([index]*[max2find])-([max2find]-1)[/math]-[math show=T]([GarysStarter]+[max2find]-1)[/math]</a> |
[/Loop]
[!]---END Gary Krockover's shownext replacement-----[/!]

donovan brooke - lists(AT)euca.us 
10/17/2009 at 18:28:21
Since the docs use WebDNA's commands as an example here, I thought I'd update this here with the preferred use of shownext, which is using commands.

Here is a table of data:
[table name=testtable&fields=field1,field2,field3]
1 1 1
2 2 2
3 3 3
4 4 4
5 5 5
6 6 6
7 7 7
8 8 8
9 9 9
10 10 10
[/table]

Here is a simple use of SHOWNEXT:

[search table=testtable&nefield1datarq=find_all&rank=off&max=2&startat=[startat]]
[ShowNext position=begin]
<a href="readdateformat.html?startat=[start]">Show items [start]-[end]</a><br>
[/ShowNext]

[ShowNext position=middle]
Show items [start] - [END]<br>
[/ShowNext]

[ShowNext position=end]
<a href="readdateformat.html?startat=[start]">Show items [start]-[end]</a><br>
[/ShowNext]

[founditems]
[field1],[field2],[field3]<br>
[/founditems]

[/search]

---------------

For a more google-like use. look here:

http://www.euca.us/admin/tests/shownext/index2.html

cheers,
Donovan



Copyright © 2008 WebDNA Software Corporation, Inc.