search_input.txp

Posted

ote that this form makes use of the following tag…

<txp:text />

…which is used to target language strings from the database ‘txp_lang’ table for the language you set in the Textpattern preferences. For example to display ‘Search’ in your chosen language the tag would be:

<txp:text item="search" />

You can get a idea of the items you can target with this tag by looking through the specific language file within the textpattern -> lang directory which was created as part of your installation. You would probably not use this tag very often unless you were designing a multi-language site as it adds needlessly to the amount of PHP database calls (that is also true for other tags such as <txp:site_name />) – it’s included here purely as an example of what the tag is for.

<section itemscope itemtype="http://schema.org/WebSite">
    <h4>
        <txp:text item="search" />
    </h4>
    <meta itemprop="url" content="<txp:site_url />">
    <form role="search" method="get" action="<txp:site_url />" itemprop="potentialAction" itemscope itemtype="http://schema.org/SearchAction">
        <meta itemprop="target" content="<txp:site_url />?q={q}">
        <p>
            <input name="q" type="search" autosave="saved-searches" results="5" itemprop="query-input"<txp:if_search> value="<txp:search_term />"</txp:if_search>>
            <input type="submit" value="<txp:text item="go" />">
        </p>
    </form>
</section>

Author