search_results.txp

Posted

This form displays the search results, if any exist.

<!-- count how many results return -->
<txp:article pgonly="1" />

<txp:if_search_results>

    <!-- if search result count greater than 200 then display excessive results message, otherwise show search result count -->
    <txp:if_search_results max="200">
        <h3>
            <txp:search_result_count />
            <txp:text item="matching_search_request" />
            <q>
                <txp:search_term />
            </q>
        </h3>
    <txp:else />
        <h3>
            <txp:text item="too_common_search_term" />
            <q>
                <txp:search_term />
            </q>
        </h3>
    </txp:if_search_results>

<!-- if no search results, then display no search results message -->
<txp:else />
    <h3>
        <txp:text item="no_search_matches" />
    </h3>

</txp:if_search_results>

<!-- display resulting articles (10 per page; default setting) -->
<txp:article class="article-list" wraptag="ul">

    <li class="article" itemscope itemtype="http://schema.org/Article">
        <h4 itemprop="name headline">
            <a href="<txp:permlink />" itemprop="url">
                <txp:title />
            </a>
        </h4>

        <!-- if the article has an excerpt, display that, otherwise show highlighted keywords in context of article -->
        <txp:if_excerpt>
            <div itemprop="description">
                <txp:excerpt />
            </div>
        <txp:else />
            <p>
                <txp:search_result_excerpt />
            </p>
        </txp:if_excerpt>

        <p class="footnote">
            <txp:text item="posted" />
            <time datetime="<txp:posted format="iso8601" />" itemprop="datePublished">
                <txp:posted />
            </time>
            &#183;
            <txp:text item="author" />
            <span itemprop="author" itemscope itemtype="http://schema.org/Person">
                <span itemprop="name">
                    <txp:author link="1" this_section="1" />
                </span>
            </span>
        </p>
    </li>

</txp:article>

<!-- check if there are further results and provide pagination links or disabled buttons depending on the result,
     this method is more flexible than using simple txp:older/txp:newer tags -->
<txp:if_search_results min="11">

    <txp:variable name="prev" value='<txp:older />' />
    <txp:variable name="next" value='<txp:newer />' />

    <p class="paginator">
        <txp:if_variable name="next" value="">
        <txp:else />
            <a rel="prev" href="<txp:newer />" title="<txp:text item="prev" />">
                ← <txp:text item="prev" />
            </a>
        </txp:if_variable>

        <txp:if_variable name="prev" value="">
        <txp:else />
            <a rel="next" href="<txp:older />" title="<txp:text item="next" />">
                <txp:text item="next" /> →
            </a>
        </txp:if_variable>
    </p>

</txp:if_search_results>

Author