[pmwiki-users] Showing pagelist iff searchresults is empty - answer

Steve Glover steve.glover at ed.ac.uk
Mon Nov 24 03:01:05 CST 2008


Hi,

> Is there a way, please, of doing something like:
> 
> !!! Table Search
> 
> (:searchbox fmt=Services.Template#tabler3 group=Services 
> name=????-??-??-* count=999 order=$:Sname:)
> 
> (:searchresults:)
> 
> (:if equal "{$SomeVariableorOther}" "SomethingElse" :)
> (:pagelist fmt=Services.Template#tabler3 group=Services 
> name=????-??-??-* count=999 order=$:Sname :)
> (:ifend:)
> 
> Which is to say when the user comes to a page, I'd like them to see the 
> result of the pagelist with a searchbox above it, but if the searchbox 
> is used for a search, then I'd like to display the searchresults and no 
> pagelist?

The answer to this uses Mateusz Czaplinsky's $SearchQuery:

http://www.pmwiki.org/wiki/Cookbook/SearchQueryVariable

giving:

(:searchbox :)
(:if equal "{$SearchQuery}" "" :)
(:pagelist fmt=Services.Searcher#tabler3 group=Services 
name=????-??-??-* count=999 order=$:Sname :)
(:else:)
(:searchresults fmt=Services.Searcher#tabler3 group=Services 
name=????-??-??-* count=999 order=$:Sname :)
(:ifend:)

Cheers

Steve

-- 
Steve Glover: SDSS, EDINA, Causewayside House, 160 Causewayside EH9 1PR
e:steve.glover at ed.ac.uk t:0131 650 2908 f:0131 650 3308 m:07961 446 902

The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.



More information about the pmwiki-users mailing list