Newscoop 3 Cookbook

Search form

Form Search

Purpose:

Generate the search form and data fields for searching keywords in published articles. By default the search action is performed in the current publication only.

Syntax:

{{ searform [template="<template_name>"] submit_button="<button_name>"
               [html_code="<html_code>"]
               [button_html_code="<html_code>"] }}
   <list_of_instructions>
{{ /searform }}
  • <template_name> is the name of the next template to be requested from the search form
  • <button_name> is the name of the button for submitting the form
  • html_code: you can insert whatever HTML code you want in the <form> statement; for example: {{ user_form .. html_code="id=\"my_id\"" }}
  • button_html_code: you can insert whatever HTML code you want in the button input field statement; such as: {{ user_form .. button_html_code="id=\"my_submit_id\"" }}

The list of instructions may contain any instruction allowed in the current context.

Setting the search scope: whether to search in all publications, in the current publication, in the current issue or in the current section. Insert the following field in the search form:

{{ camp_select object="search" attribute="level" }}

Constraints:

Can not be used within itself (e.g. search in search).

Edit Search

Purpose:

Generates a text input field so that a reader can search for articles on your site. This statement should be used inside the search form.

Syntax:

{{ camp_edit object="search" attribute="<attribute>"
                             [html_code="<HTML_code>"]
                             [size ="<field_length>"] }}

Filters:

<attribute> being one of the following:

  • keywords: allows search keywords input
  • start_date: select only articles published starting on the selected date
  • end_date: select only articles published up to the selected date

Constraints:

The search edit field can be used only inside the search form.

Select Search

Purpose:

Generates a check box or a pop-up list for selecting the search mode or the search level respectively. This statement should be used inside the search form.

Syntax:

{{ camp_select object="search" attribute="<attribute>"
                               [html_code="<HTML_code>"] }}

Filters:

<attribute> being one of the following:

  • mode: if checked, the search will return articles that contain all entered keywords; if not checked, it will return articles that contain at least one keyword
  • level: allows the reader to select the scope of the search: multiple publications, publication, issue, section
  • section: select only articles that are in the given section
  • issue: select only articles that are in the given issue

Constraints:

The select search field can only be used inside the search form.