Search($search, $entry_type, $sort, $pagesize, $page)

Search function are used to find the keyword(s) within the entry name/title of the entry, see also Fulltext

Syntax:

{$archive->Search($search, $entry_type, $sort, $pagesize, $page)}
Parameter Default Value Description Sample Value
$search n/a String - keyword that is used to match entry records. keyword(s)
$entry_type * String - filters the result by the entry type (comma delimited) * or
news or
news,events,books
$sort _date_created DESC String - sorts the records either ASC or DESC by a selected field. eventdate DESC
$pagesize 20 Integer - maximum results per page 10
$page 1 Integer - Selects the records on a particular page 1

Sample Usage:

{assign var="news" value=$archive->Search("HEADLINE","news","eventdate DESC",10,1))}

{foreach item="$news_item" from=$news}
<h2>$news_item.title</h2> <br/>
<i>$news_item.eventdate|date_format</i> <br/>
<p>$news_item._short_description</p> <br/>
{/foreach}

Sample Output:

Keyword: HEADLINE
<h2>NEWS HEADLINE 2</h2> <br/>
<i>April 18,2008</i> <br/>
<p>News 2: second short description </p> <br/>

<h2>NEWS HEADLINE 1</h2> <br/>
<i>April 17,2008</i> <br/>
<p>News 1: first short description </p> <br/>