search.twig 1.1 KB

12345678910111213141516171819202122232425
  1. {% extends "index.twig" %}
  2. {% set sstring = url_param('q','string' ) %}
  3. {% set advice = '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!' %}
  4. {% block content %}
  5. <div>
  6. <blockquote>{{ search_tooltip }}</blockquote>
  7. </div>
  8. {% if not sstring %}<h4>Please do not use an empty search string.<br />{{ advice|raw }}</h4>
  9. {% else %}
  10. {# it would be nice if the search weren't repeated for each page... #}
  11. {% set sstring = sstring|lower %}
  12. {% set paging_array = {} %}
  13. {% for page in tbpages %}
  14. {% if sstring in page.id|content|striptags|lower or sstring in page.title|striptags|lower or sstring in page.id|lower %}
  15. {% set paging_array = paging_array|merge([page]) %}
  16. {% endif %}
  17. {% endfor %}
  18. {% set count = paging_array|length %}
  19. <h4>{{ count }} search results for "{{sstring}}"
  20. {% if count == 0 %}<br />{{ advice|raw }}{% endif %}</h4>
  21. {% set paging_url_base = current_page.url ~ '?q=' ~ sstring ~ '&' %}
  22. {% include 'includes/paging.twig' %}
  23. {% endif %}
  24. {% endblock content %}