version=pmwiki-2.2.5 ordered=1 urlencoded=1 agent=Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/532.0 (KHTML, like Gecko) Chrome/3.0.195.21 Safari/532.0 author=simon charset=ISO-8859-1 csum=change dummy parameters ctime=1138643894 host=203.97.214.12 name=PmWiki.PageLists rev=195 targets=PmWiki.PageListTemplates,PmWiki.DocumentationIndex,PmWiki.PageTextVariables,PmWiki.WikiTrails,Site.PageListTemplates,PmWiki.Categories,PmWiki.ConditionalMarkup,PmWiki.PageDirectives,PmWiki.PagelistVariables text=(:Audience: authors, admins (intermediate) :)%0a(:Summary:Listing pages by multiple criteria with templated output:)%0aPmWiki comes with two directives for generating lists of pages -- [@(:pagelist:)@] and @@[=(:=]searchresults:)@@. Both directives are basically the same and each accepts the parameters documented below. The primary difference between the two is that searchresults generates the "Results of search for ..." and "### pages found out of ### searched" messages around the results.%0a%0aThe [@(:searchbox:)@] directive generates a search form (input text box) to submit search queries. The markup generally accepts the same parameters as [@(:pagelist:)@], which makes it possible to restrict, order and format searchresults in the same ways that are described below for a [@(:pagelist:)@]. For more information about the [@(:searchbox:)@] directive, and the ways in which it differs from a [@(:pagelist:)@], skip to the section [[#searchbox|below]].%0a%0a!! Basic syntax%0a%0a* [@(:pagelist:)@] %0a->without any arguments shows a bulleted list of all pages, as links, ordered alphabetically and in groups.%0a* @@[=(:=]pagelist [[#pagelistgroup|group]]=''ab'' \%0a [[#pagelistname|name]]=''cd'' \%0a [[#pagelistfmt|fmt]]=''[[page list templates|template]]'' \%0a [[#pagelistlist|list]]=''ef'' \%0a [[#pagelistorder|order]]=''gh'' \%0a [[#pagelistcount|count]]=''123'' \%0a [[#pagelistlink|link]]=''ij'' \%0a [[#pagelisttrail|trail]]=''kl'' \%0a [[#pagelistwrap|wrap]]=''mn'' \%0a [[#pagelistpasswd|passwd]]=''op'' \%0a [[#pagelistif|if]]=''qr'' \%0a [[#pagetextvariables|$:''ptv'']]=''st'' \%0a [[#pagevariables|$''pv'']]=''uv'' \%0a [[#pagelistcache|cache]]=0 \%0a ''[[#pagelistarg|argument]]1'' -''[[#pagelistarg|argument]]2'' ''etc'' \%0a [[#includevariable|variable]]=''value'' \%0a [[#pagelistclass|class]]=''class'' \%0a :)@@ %0a->shows a pagelist according to the parameters supplied. Parameters are optional.%0a* @@[=(:=][[#searchbox|searchbox]] value=''abc'' size=''99'' target=''def'':)@@%0a* @@[=(:=][[#searchresults|searchresults]] [[#pagelistreq|''request=1 req=1'']] :)@@%0a%0a!! Parameters%0a[[#pagelistarg]]%0aAny argument supplied within [@(:pagelist:)@] that isn't in the form @@'key=value'@@ is treated as text that either must (or must not) exist in the page text.%0a%0aThe minus sign (-) or exclamation mark (!) can be used to indicate the logical ''not''. Thus%0a->[@(:pagelist trail=PmWiki.DocumentationIndex list=normal apple !pie:)@]%0alists all "normal" pages listed in the [[Documentation Index ]] trail that contain the word "apple" but not "pie".%0a%0a!!![[#pagetextvariables]]With page text variables%0aYou can also use [[page text variables]] as a ''key'' to list pages according to the existence of a page text variable. Eg : %0a->[@(:pagelist $:pagetextvar=avalue:)@]%0alists pages having ''$:pagetextvar'' set to ''avalue''.%0a[[%3c%3c]]%0aMinus sign (-), wildcards (?*) and a comma separated list of values also works when specifying a selection based on pagetextvariables. Eg :%0a->[@(:pagelist $:apagetextvar=t*,-test:)@]%0alists pages having $:apagetextvar like 't*' but not 'test'.%0a[[%3c%3c]]%0aExamples:%0a||width=* class="tabtable" rules=rows%0a||PTV is set (is not empty): ||[@(:pagelist $:MyPageTextVariable=- :)@]||%0a||PTV is empty or not set:[[%3c%3c]] (ie, is not set to one char followed by 0 or more chars) ||[@(:pagelist $:MyPageTextVariable=-?* :)@]||%0a||PTV is not VALUE: ||[@(:pagelist $:MyPageTextVariable=-VALUE :)@]||%0a||PTV is set and not YES: ||[@(:pagelist $:MyPageTextVariable=?*,-YES :)@]||%0aBe aware that if using [@(:pagelist $:MyPTV=$:YourPTV :)@] PTVs include PmWiki formatting, so you may not get the matches you expect. Currently the only way around this is to use wild cards, so if the formatting is embedded you may be out of luck.%0a%0a!!![[#pagevariables]]With page variables (PV)%0a%0aPage variables can be used within pagelists in the same way as page text variables. See [[#pagetextvariables|Page Text Variables]] above for more details. Simply use $var instead of $:var.%0a%0a!!![[#pagelistgroup]] group= and [[#pagelistname]]name= %0a%0aThe "[@group=@]" and "[@name=@]" parameters limit results to pages in a specific group or with a specific name:%0a(:table class='tabtable' rules=rows:)%0a(:cellnr:)All pages in the Pmwiki group:%0a(:cell:)[@(:pagelist group=PmWiki :)@]%0a(:cellnr:)All pages except those in the PmWiki or Site groups:%0a(:cell:)[@(:pagelist group=-PmWiki,-Site :)@]%0a(:cellnr:)All RecentChanges pages%0a(:cell:)[@(:pagelist name=RecentChanges :)@]%0a(:cellnr:)All pages except RecentChanges%0a(:cell:)[@(:pagelist name=-RecentChanges :)@]%0a(:tableend:)%0a%0a!!! Wildcards%0aName and group parameters can contain ''wildcard'' characters that display only pages matching a given pattern:%0a* An asterisk (*) represents zero or more characters%0a* A question mark (?) represents exactly one character%0a%0aExamples:%0a(:table class='tabtable' rules=rows:)%0a(:cell:)All pages in any group beginning with "PmWiki"%0a(:cell:)[@(:pagelist group=PmWiki* :)@]%0a(:cellnr:)All pages in any group beginning with "PmWiki", except for Chinese%0a(:cell:)[@(:pagelist group=PmWiki*,-PmWikiZh :)@]%0a(:cellnr:)All pages in the PmCal group with names starting with "2005":%0a(:cell:)[@(:pagelist name=PmCal.2005* :)@]%0a(:cellnr:)All Cookbooks with names beginning with a A and a B letter%0a->note the different separators used for the same result%0a(:cell:)[@%0a(:pagelist group=Cookbook name=A*,B* :)%0a(:pagelist group=Cookbook name="A* B*" :)%0a(:pagelist group=Cookbook name=[AB]* :)%0a(:pagelist group=Cookbook, name=[AB]* :)@]%0a(:tableend:)%0a%0aIf you want to use multiples conditions in name you need to use quotes or commas to delimit the string. %0a%0a!!![[#pagelisttrail]] trail= %0aThe "[@trail=@]" option obtains the list of pages to be displayed from a [[WikiTrail(s)]]:%0a* Display pages in the documentation by modification time%0a->[@(:pagelist trail=PmWiki.DocumentationIndex order=-time:)@]%0a* Display five most recently changed pages%0a-%3c[@(:pagelist trail=RecentChanges count=5:)@]%0a%0a!!![[#pagelistlist]] list= %0a%0aThe "[@list=@]" option allows a search to include or exclude pages according to predefined patterns set by the administrator. %0a* "[@list=normal@]" is predefined, and which excludes things like AllRecentChanges, RecentChanges, GroupHeader, GroupFooter, GroupAttributes, and the like from being displayed in the list results. Note that list=normal also excludes the current page.%0a* "[@list=all@]" over-rides a "default" list that may be set by the wiki's administrator to exclude groups such as PmWiki or Site from regular search results.%0a* Wiki administrators can define custom lists via the $SearchPatterns array (see [[Cookbook:SearchResults]]).%0a%0a!!![[#pagelistfmt]] fmt= %0a%0aThe "[@fmt=@]" option determines how the resulting list should be displayed. %0aPmWiki [[Site/PageListTemplates|predefines]] several formats:%0a* @@fmt=#bygroup@@ - Display pages within groups (default format)%0a* @@fmt=#simple@@ - Display a simple ordered list of pages in the form Group.Name%0a* @@fmt=#title@@ - Display a list of pages by page title. Use "[@order=title@]" to have them sorted by title (default is to order by page name).%0a* @@fmt=#group@@ - Display a list of wikigroups (without listing the pages in the groups)%0a* @@fmt=#include@@ - Display the contents of each page in the list (note, this could take a very long time for long lists!)%0aThese formats are defined by [[page list templates]], which can be customized.%0a%0aThis format is not predefined by a page list template:%0a* @@fmt=count@@ - Display the number of pages in the list (note the absence of the "#").%0a%0a%0a!!![[#pagelistlink]] link= %0a%0aThe "[@link=@]" option implements "backlinks" -- i.e., it returns a list of pages with a link to the target. It's especially useful for [[categor(ies)]]y pages and finding related pages.%0a%0a* all pages with a link to PmWiki.DocumentationIndex%0a->[@(:pagelist link=PmWiki.DocumentationIndex:)@]%0a* all pages with links to the current page%0a->[@(:pagelist link={$FullName}:)@]%0a* all pages in the "Skins" category%0a->[@(:pagelist link=Category.Skins:)@]%0a%0a!!![[#pagelistcount]] count= %0a%0aThe "[@count=@]" option provides the ability to%0a* limit the pagelist to a specific number of pages%0a* subsets of a list%0a* return items from the end of a list, subsets of a list%0a* display pages in reverse sequence%0a%0a(:table class=tabtable rules=rows:)%0a(:cellnr:)A simple bullet list of ten most recently modified pages%0a(:cell:)%0a[@(:pagelist trail=Site.AllRecentChanges count=10 fmt=#simple:)@]%0a(:cellnr:)Display the first ten pages of a list%0a(:cell:)%0a[@count=10 # display the first ten pages of list@]%0a(:cellnr:)Negative numbers specify pages to be displayed from the end of the list:%0a(:cell:)%0a[@count=-10 # display last ten pages of list@]%0a(:cellnr:)Ranges may be specified using '..', thus:%0a(:cell:)%0a[@count=1..10 # first ten pages of list%0acount=5..10 # 5th through 10th pages of list@]%0a(:cellnr:)Negative numbers in ranges count from the end of the list:%0a(:cell:)%0a[@count=-10..-5 # 10th from end, 9th from end, ..., 5th from end@]%0a(:cellnr:)Omitting the start or end of the range uses the start or end of the list:%0a(:cell:)%0a[@count=10.. # skip first ten pages%0acount=..10 # 1st through 10th page of list%0acount=-10.. # last ten pages of list%0acount=..-10 # all but the last nine pages@]%0a(:cellnr:)Ranges can be reversed, indicating that the order of pages in the output should likewise be reversed:%0a(:cell:)%0a[@count=5..10 # 5th through 10th pages of list%0acount=10..5 # same as 5..10 but in reverse sequence%0acount=-1..1 # all pages in reverse sequence@]%0a(:cellnr:)"Reverse sequence" here refers to the sequence ''after'' any sorting has taken place. Therefore the three directives to the right are equivalent:%0a(:cell:)%0a[@(:pagelist order=-name count=10:)%0a(:pagelist order=-name count=1..10:)%0a(:pagelist order=name count=-1..-10:) @]%0a(:tableend:)%0a%0a!!![[#pagelistwrap]] wrap=%0aThe "[@wrap@]" option has the values, ''none'' and ''inline''.%0a%0aWith "wrap=inline" and "wrap=none", the output from pagelist (markup or HTML) is directly embedded in a page's markup without any surrounding %3cdiv> class=...%3c/div> tags.%0a%0aWith "wrap=inline", any surrounding %3cul> is continued. Without "wrap=inline", the HTML output starts a new %3cul>. This is important if you want to get a second level %3cul> produced by the page list since starting a new %3cul> with "**" doesn't yield a second level %3cul> but %3cdl>%3cdd>%3cul>...%0a%0a"wrap=inline" likely has other effects since it suppresses the call to $FPLTemplateMarkupFunction (being MarkupToHTML by default).%0a%0a!!![[#pagelistclass]] class=%0aBy default, a pagelist has the 'fpltemplate' class. The 'bygroup', 'simple', 'group' and 'title' page list formats have specific class names fplbygroup, fplsimple etc. You can set any class using the class= parameter or by setting the $FPLFormatOpt array.%0a%0a!!![[#pagelistpasswd]] passwd=%0aThe "[@passwd@]" option returns only those pages that have some sort of password attribute on them.%0a%0a!!![[#pagelistif]] if=%0aThe "[@if@]" option allows a condition to be specified as part of the pagelist processing, rather than from within the [[page list template(s)]]. Only those pages for which the condition is true are retrieved. Anything that could [[ConditionalMarkup | go within an [@(:if ...:)@]]] can be used as a condition. For example%0a%0a [@(:pagelist if="date {(ftime %25GW%25V {*$Name})} {=$Name}" :)@]%0a%0areturns all of the pages where the name is in the same week as that of the current page.%0a%0a!!![[#pagelistorder]] order=%0a%0aThe "[@order=@]" option allows the pages in the list to be sorted according to different criteria. Use a minus sign to indicate a reverse sort. Multiple sorting criteria can be specified using a comma, and you can create your own [[(PmWiki:)custom pagelist sort order]]:%0a* [@order=name@] - alphabetically by name (default order)%0a* [@order=title@] - alphabetically by title rather than names%0a* [@order=time@] - most recently changed pages '''last'''%0a* [@order=ctime@] - time of page creation (see note)%0a* [@order=size@] - page size (not file size), smallest pages first%0a* [@order=group,title@] - by multiple criteria, in this instance sort by title within groups%0a* [@order=random@] - shuffle the pages into random sequence%0a* [@order=$:pagetextvarname@] - alphabetically by [[PageTextVariables|page text variable]] value%0a%0aAlso, the [@order=@] option allows custom ordering functions to be written.%0a->Note: fmt=trail results in an unordered pagelist, i.e. the trail order is preserved in the pagelist. So PmWiki's alphabetical default order does not apply in this case.%0a->Note: ctime was added to pages only from pmwiki 2.1.beta15 onwards, pages created by earlier versions don't carry a ctime attribute and can't be sorted that way.%0a%0a[[#pagelistcache]]%0a!!! cache=0%0aPagelist has the capability to cache lists which greatly speeds up processing. Every once in a while this caching can result in undesired results. Specifying @@cache=0@@ disables caching.%0a%0a%0a[[#includevariable]]%0a!!!! Specifying variables as parameters%0aYou can also specify variable values inline with the pagelist statement, and refer to the variables in the template using the [@{$$variable1}@] format:%0a-> [@(:pagelist fmt=#pagelist variable1="value" variable2="value2":)@]%0a%0aThis assumes that a site has $EnableRelativePageVars enabled, which is recommended in PmWiki 2.2.0 -- but disabled by default to help people upgrading from 2.1.x.%0a%0aFor example, in the template:%0a%0a(:markup:)%0a>>comment%3c%3c%0a[[#tvars]]%0a(:template default count=1 ParamName=Simon:)%0aHi, {$$ParamName}, how are you today?%0a[[#tvarsend]]%0a>>%3c%3c%0a(:markupend:)%0a%0aThis gives:%0a%0a(:markup class=horiz:)%0a(:pagelist fmt=#tvars ParamName="Sam":)%0a%0a(:pagelist fmt=#tvars ParamName="Sally":)%0a%0a(:pagelist fmt=#tvars:)%0a(:markupend:)%0a%0a!! Examples%0a%0aInclude the contents of a random page from the Banners group:%0a->[@(:pagelist group=Banners order=random count=1 fmt=#include list=normal:)@]%0a%0aDisplay a simple list of the last ten recently changed pages:%0a->[@(:pagelist trail=Site.AllRecentChanges count=10 fmt=#simple:)@]%0a%0aDisplay the "top twenty" biggest cookbook pages:%0a->[@(:pagelist group=Cookbook order=-size count=20 :)@]%0a%0a!![[#searchbox]] The Searchbox Directive%0a%0aThe [@(:searchbox:)@] directive generally accepts the same parameters as [@(:pagelist:)@] and [@(:input text:)@] directives:%0a* Pagelist parameters can be added to the input text of a searchbox (or to the markup, or both)%0a* Input text box parameters can be added to the searchbox markup%0a** An initial search string can be specified in the searchbox markup, but it must be in the form @@value='search string'@@. That search string is displayed in the input text and can be modified by when the search is run.%0a** The size of the text input field can be specified with the size parameter, where "size=40" would specify the current default value.%0a*** Tip: If more than one searchbox appears on a page, adding a blank initial value like this @@value=''@@, to the markup for each searchbox will prevent a search string for one box from populating all of the other boxes.%0a* The target page for displaying searchbox results can be set with the parameter @@target=''GroupName.PageName''@@. The default is the current page. %0a* The entire searchbox form can be overridden by defining the $SearchBoxFmt variable in one's configuration file. If $SearchBoxFmt is defined, then the parameters to [@(:searchbox:)@] are ignored, and the content of the $SearchBoxFmt variable are used instead.%0a%0a[[#searchresults]]%0a!! The Searchresults directive%0aThe [@(:searchresults:)@] directive generally accepts the same parameters as [@(:pagelist:)@] and [@(:input text:)@] directives:%0a%0a!!![[#pagelistreq]] request=1 req=1%0a[=(:searchresults:)=] without the introductory line that says "Results of search for..."%0a%0a!! See Also%0a%0a* [[PageDirectives#attachlist]] - display a list of attachments%0a* [[Site.PageListTemplates]] - default pmwiki pagelist templates%0a* [[Cookbook:PagelistTemplateSamples]] - contributed pagelist template samples%0a* [[PmWiki/PageListTemplates]] - how to create custom pagelist templates for the fmt= option%0a* [[(PmWiki/)PagelistVariables]] - ''local/config.php'' customizations%0a* [[Cookbook:Forms]] - documentation for [@(:input text:)@] markup, which applies to [@(:searchbox:)@]%0a* [[(PmWiki:)CustomPagelistSortOrder]] - creating custom order sort functions%0a* [[Cookbook:CustomPagelistSortOrderFunctions]] - {Cookbook.CustomPagelistSortOrderFunctions$:Summary}%0a time=1254027370