{init_search_results} (ver3)
Init_search_results allows developers design their own search result pages. Since version 3.2.8.
Parameters
- name - variable name where the returned data is saved.
- amount_of_pages - defines how many page links are displayed in the paging list.
- pagenum_separator - the character that separates the page number in the paging list
- pagenum_next_chr - the character (string) for the link to the next product list's page
- pagenum_prev_chr - the character (string) for the link to the previous product list's page
- pagenum_link_class - the CSS-class for the links in the paging list
- pagenum_numbers_style - the CSS-class for the numbers in the paging list
Elements
- .link - prints the URL to the found object.
- .link_target - prints the target of the result.
- .title - prints the title of the found object.
- .lead - prints the lead of the found object.
General tags
- <name>_pages - prints the default paging list.
- <name>_pages_custom - prints the custom paging list.
- <name>_next_pages - prints the link to the next pages in the paging list.
- <name>_previous_pages - prints the link to the previous pages in the paging list.
- <name>_string - prints the search string.
- <name>_count - prints the total count of the found objects.
- <name>_pages_count - prints the total count of the pages of the found objects.
- <name>_objects - array of the found objects.
- <name>_labels - array of the allowed types (labels) for search.
- t_name - prints the name of the label (type of the results).
- is_active - equals 1 if current label is active.
- is_disabled - equals 1 if current label is disabled.
- type_id - prints the class type id of the label.
To build use your own search results template, place the following code in your page template:
{if $smarty.get.otsi} {* or $smarty.post.otsi *}
{print_content tpl="search_results"}
{else}
{print_content}
{/if} Examples
{init_search_results page_seq=1 pagenum_separator=" " amount_of_pages=3 pagenum_next_chr="<b>›</b>" pagenum_prev_chr="<b>‹</b>"}
{******************* Search labels ********************}
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td background="{$img_path}/otsing_taust.gif"><img src="px.gif" width="7" height="7"></td>
{foreach from=$search_labels item=label}
{* Found results AND label is active *}
{if $label.is_active AND ! $label.is_disabled}
<td><img src="{$img_path}/tab_on_left.gif" width="10" height="19"></td>
<td background="{$img_path}/tab_taust.gif" class="tabOn">{$label.t_name}</td>
<td><img src="{$img_path}/tab_on_right.gif" width="10" height="19"></td>
{* No result: label disabled*}
{elseif ! $label.is_active AND $label.is_disabled}
<td><img src="{$img_path}/tab_off_left.gif" width="10" height="19"></td>
<td background="{$img_path}/tab_off_taust.gif" class="deadTab">{$label.t_name}</td>
<td><img src="{$img_path}/tab_off_right.gif" width="10" height="19"></td>
{* Found results AND label is inactive*}
{else}<BR> <td><ahref="?otsi={$search_string}&tyyp_id={$label.type_id</FONT>}&lk=1"><imgsrc="{$img_path}/tab_off_left.gif"width="10"height="19"border="0"></a></td><BR> <tdbackground="{$img_path}/tab_off_taust.gif"class="tabOff"><ahref="?otsi={$search_string}&tyyp_id= {$label.type_id}&lk=1" class="link_tab_off">{$label.t_name}</a></td>
<td><ahref="?otsi={$search_string}&tyyp_id={$label.type_id}&lk=1"><img src="{$img_path}/tab_off_right.gif" width="10" height="19" border="0"></a></td>
{/if}
{/foreach}
</tr>
</table>
</td>
<td width="100%" background="{$img_path}/otsing_taust.gif"></td>
</tr>
</table>
{*******************// Search labels ********************} <br>
<span class="plk">{sysword word="Results" type="Search"}</span>
{if $search_count}
<br>
{else}
<br><br>
<table border="0" cellpadding="1" cellspacing="0" class="teade" bgcolor="#686868" width="100%">
<tr>
<td>
<table border="0" cellpadding="10" cellspacing="0" class="teade" bgcolor="#FFFFFF" width="100%">
<tr>
<td> No results!</td>
</tr>
</table>
</td>
</tr>
</table>
{/if}
<br>
{sysword word="Keyword" type="Search"}: "<strong>{$search_string}</strong>", {sysword word="Results" type="Search"} <strong>{$search_count}</strong><br>
{if $search_count}
<br>
<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#EDEDED">
<tr>
<td><img src="{$img_path}/px.gif"></td>
</tr>
</table>
<table width="100%" border="0" cellpadding="5" cellspacing="0" class="lehed">
<tr>
<td align="center" class="txt">
{if $search_pages_custom}
{*******************Paging********************}<BR> <ahref="?lk=1&otsi={$search_string}&tyyp_id={$search_tyyp_id}"><b>«</b></a>{$search_previous_pages}{$search_pages_custom}{$search_next_pages}<ahref="?lk={$search_pages_count}&otsi={$search_string}&tyyp_id={$search_tyyp_id}"><b>»</b></a>
{******************* //Paging ********************} {else}
1-{$search_count}
{/if}
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#EDEDED">
<tr>
<td><img src="{$img_path}/px.gif"></td>
</tr>
</table>
{******************* Results ********************}
<ol start={$search_start_pos}>
{foreach from=$search_objects item=obj}
<li>
<a href="{$obj.link}" {$obj.link_target}><strong>{$obj.pealkiri}</strong></a><br>
<span class="otsingutulemus">{$obj.sisu}</span>
<br><br>
</li>
{/foreach}
</ol>
{******************* // Results ********************}
<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#EDEDED">
<tr>
<td><img src="{$img_path}/px.gif"></td>
</tr>
</table>
<table width="100%" border="0" cellpadding="5" cellspacing="0" class="lehed">
<tr>
<td align="center" class="txt">
{if $search_pages_custom}
{*******************Paging********************}<BR> <ahref="?lk=1&otsi={$search_string}&tyyp_id={$search_tyyp_id}"><b>«</b></a>{$search_previous_pages}{$search_pages_custom}{$search_next_pages}<ahref="?lk={$search_pages_count}&otsi={$search_string}&tyyp_id={$search_tyyp_id}"><b>»</b></a>
{******************* //Paging ********************}
{else}
1-{$search_count}
{/if}
</td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#EDEDED">
<tr>
<td><img src="{$img_path}/px.gif"></td>
</tr>
</table>
{/if}
