Template:Searchnews: Difference between revisions

Jump to navigation Jump to search
No edit summary
No edit summary
 
(41 intermediate revisions by the same user not shown)
Line 1: Line 1:
<includeonly>{{#dpl:
<includeonly>{{#dpl:
debug=3
category=Published
|category=Published
|debug=0
|allowcachedresults=true
|uses=Template:Newstitle
|namespace=News
|namespace=News
|notcategory=Disputed
|notcategory=Disputed
Line 13: Line 15:
|userdateformat=Y-m-d (D)
|userdateformat=Y-m-d (D)
|mode=userformat
|mode=userformat
|format  = ,\n'''[[%PAGE%|%DATE%: %TITLE%]]'''\n,,
|format  = ,,,
|noresultsheader=&nbsp;
|noresultsheader=* (no results - search [[:Category:Published|all news]])
|distinct=true
|distinct=true
|resultsheader=
|resultsheader=
|include=*
|include={newsarticle}.dplsearch2,{newstitle}.dpl
|includemaxlength=1
|includematch=/({{{find}}}{{ #foreach: find$n$ |{{!}}{{{find$n$}}}}})/si
|includematch={{Jb_makeregexp_pre}}{{{find}}}{{!}}{{ #foreach: find$n$ |{{!}}{{{find$n$}}}}}{{Jb_makeregexp_post}}
|count=50
|count={{#if:{{{articlecount|}}}|{{{articlecount}}}|100}}
}}</includeonly>
}}</includeonly>
{{Jb_makeregexp_pre}}{{{find}}}{{!}}{{ #foreach: find$n$ |{{!}}{{{find$n$}}}}}{{Jb_makeregexp_post}}
|titlematch=%{{{find}}}%{{ #foreach: find$n$ |{{!}}%{{{find$n$}}}%}}
<noinclude>
<noinclude>
<!-- |titlematch=%{{{find}}}%{{ #foreach: find$n$ |{{!}}%{{{find$n$}}}%}} -->
__TOC__
__TOC__
=== Template usage ===
== Template usage ==
* use like
* use like
** <nowiki>{{Listnews}}</nowiki> to display recent news (30 articles by default)
** <nowiki>{{Searchnews}}</nowiki> to display all news titles (10 articles by default)
** <nowiki>{{Listnews|articlecount=1}}</nowiki> to display most recent 1 news article.
** <nowiki>{{Searchnews|find=pci}}</nowiki> to search for pci (case insensitive).
** <nowiki>{{Listnews|articlecount=50}}</nowiki> to display 50 recent news articles.
** <nowiki>{{Searchnews|find=pci|find1=STEMI}}</nowiki> to search for pci OR STEMI (case insensitive).
* Note: default article display limit is set by [[:Template:Newsarticle.dpl]]
** <nowiki>{{Searchnews|find=pci|find1=\bMI\b}}</nowiki> to search for pci OR MI (case insensitive, MI occuring as a whole word).
* Note: default number of articles is 30 articles


=== Template customization ===
=== Notes on usage===
* [[:Template:newsarticle.dpl|Edit display per article in news listing]]
# First search term (parameter 'find') is required --
* [[:Template:newsarticle|Edit display of summary in article contents]]
#* Can use as many additional search terms (find1, find2, ... find#)
* [[:Template:NewsStub|View use of news article template]]
#* All search terms are joined by OR statement.
# Article results are sorted by most recent, according to date passed to [[:Template:Newsarticle]]
# All searches are case-insensitive. Can specify word-breaks using \b (end-of-word)
# Default title display is set by [[:Template:Newsarticle.dplsearch2]]
# Default number of articles is 5 (set in [[:Template:Newsarticle.dplsearch2]])
# The entire contents of the news article are NOT searched -- search occurs within the contents of page title (per mediawiki), the ''summary'' term of the [[:Template:Newsarticle|Newsarticle template]], and the contents of ''keywords'' optionally passed to [[:Template:Newsarticle]]
 
 
== Template customization ==
* [[:Template:newsarticle.dplsearch|Edit display per article in news listing]]
 
== See also ==
* [[:Template:Listnews]] which lists news titles + summary (no search capacity)
 
== example display (last recent news with defaults) ==
'''<nowiki>{{searchnews|find=PCI|find1=intervention|find2=STEMI}}</nowiki>'''
{{searchnews|find=PCI|find1=intervention|find2=STEMI}}


=== example display (last recent news with defaults) ===
{{searchnews|articlecount=10|find=[cC]lopidogrel}}
</noinclude>
</noinclude>

Latest revision as of 03:53, 18 February 2009


Template usage

  • use like
    • {{Searchnews}} to display all news titles (10 articles by default)
    • {{Searchnews|find=pci}} to search for pci (case insensitive).
    • {{Searchnews|find=pci|find1=STEMI}} to search for pci OR STEMI (case insensitive).
    • {{Searchnews|find=pci|find1=\bMI\b}} to search for pci OR MI (case insensitive, MI occuring as a whole word).

Notes on usage

  1. First search term (parameter 'find') is required --
    • Can use as many additional search terms (find1, find2, ... find#)
    • All search terms are joined by OR statement.
  2. Article results are sorted by most recent, according to date passed to Template:Newsarticle
  3. All searches are case-insensitive. Can specify word-breaks using \b (end-of-word)
  4. Default title display is set by Template:Newsarticle.dplsearch2
  5. Default number of articles is 5 (set in Template:Newsarticle.dplsearch2)
  6. The entire contents of the news article are NOT searched -- search occurs within the contents of page title (per mediawiki), the summary term of the Newsarticle template, and the contents of keywords optionally passed to Template:Newsarticle


Template customization

See also

example display (last recent news with defaults)

{{searchnews|find=PCI|find1=intervention|find2=STEMI}} {{#dpl: category=Published |debug=0 |allowcachedresults=true |uses=Template:Newstitle |namespace=News |notcategory=Disputed |notcategory=Not_published |shownamespace=false |ordermethod=sortkey |order=descending |addauthor=false |reset=categories |addfirstcategorydate=true |userdateformat=Y-m-d (D) |mode=userformat |format = ,,, |noresultsheader=* (no results - search all news) |distinct=true |resultsheader= |include={newsarticle}.dplsearch2,{newstitle}.dpl |includematch=/(PCI{{ #foreach: find$n$ ||{{{find$n$}}}}})/si |count=50 }}