1234567891011121314151617181920212223242526272829303132 |
- {% extends "index.twig" %}
- {% set sstring = url_param('q','string' ) %}
- {% set titlesonly = url_param('titlesonly','boolean' ) %}
- {% set advice = '<h4>Please do not use an empty search string.<br />Use the <span class="desktop-device">sidebar</span><span class="mobile-device">top menu</span> search box to enter a query, or try some tags!</h4>' %}
- {% block content %}
- <article>{% if not sstring %}{{ advice|raw }}
- {% else %}
- <blockquote><p>{{ search_tooltip }}</p></blockquote>
- {# it would be nice if the search weren't repeated for each page... #}
- {% set sstring = sstring|lower %}
- {% set paging_array = {} %}
- {% if titlesonly == 'true' %}
- {% for page in tbpages %}
- {% if sstring in page.title|striptags|lower %}
- {% set paging_array = paging_array|merge([page]) %}
- {% endif %}
- {% endfor %}
- {% else %}
- {% for page in tbpages %}
- {% if sstring in page.id|content|striptags|lower or sstring in page.title|striptags|lower or sstring in page.id|lower %}
- {% set paging_array = paging_array|merge([page]) %}
- {% endif %}
- {% endfor %}
- {% endif %}
- {% set count = paging_array|length %}
- <h4>{{ count }} search results for "{{sstring}}"
- {% if count == 0 %}<br />{{ advice|raw }}{% endif %}</h4>
- {% set paging_url_base = current_page.url ~ '?q=' ~ sstring ~ '&' %}
- {% include 'includes/paging.twig' %}
- {% endif %}</article>
- {% endblock content %}
|