Textpattern logo

Help?

search input

From Textbook

<txp:search_input />

The search_input tag is a single tag. This tag will provide a text entry field for search parameters and an optional button to initiate the search.

Contents

Attributes

Tag will accept the following attributes (case-sensitive):

section="section name"
Use the specified section as the destination page that will display the search results.
Default: unset (use the front page)
html_id="id"
The HTML id attribute assigned to the search form.
Default: unset.
label="text"
Label for the top of the field.
Default: Search.
button="text"
Creates and labels a button to initiate the search.
Default: unset (no button is created)
size="integer"
Sets the size of the text field.
Default: 15.
wraptag="tag"
HTML tag to wrap the search field with.
Default: p.
form="form name"
Use specified form. (Yes, a TXP-form to build a customized X/HTML form.)
Default: search_input.

Examples

Example 1: Display a search input form

<txp:search_input label="Search" button="Search" size="20" wraptag="div" />

Example 2: Elements required for building a customized (X)HTML search form

You can build your own custom search form (in a TXP form, like you do with e.g. the article tag) by specifying form="txpformname" inside the <txp:search_input /> tag.
The following is the content of txpformname and shall depict the absolute minimum of tags and attributes required:

<form action="<txp:site_url />">
<input type="text" name="q" />
</form>

If you use a customized TXP form Textpattern doesn't automatically wrap the (X)HTML form output with form tags, so you need a pair of those to enclose your code. The name="q" attribute/value pair inside the text input tag is required for even initiating a search query.

Other tags used: site_url

Textpattern, as of this writing, will use a user defined form named search_results, or an internally defined default form if no search result form is defined by you.

Genealogy

Version 4.0.7

  • html_id attribute added.

Translations [?]...

About Textbook