{% set title = __("Search") %} {% set formId = "search" %} {% set formError = getAndClearFormError(formId) %} {% extends "base.twig" %} {% block content %} <hr color="silver" noshade> <h1>{{ __("Search") }}</h1> {% if formError %} {% include "components/alert_error.twig" with { message: formError } %} {% endif %} <form action="." method="get"> <input type="hidden" name="form_id" value="{{ formId }}"> <input type="hidden" name="_action" value="search"> <table border="1" cellspacing="0" cellpadding="4" bordercolor="silver" width="100%"> <tr> <td width="100%"> <input class="fw" type="search" id="i_query" name="query" value="{{ lastFormField(formId, "query")|default(g.get.query)|default("") }}" required placeholder="{{ __("Enter your search query...") }}"> </td> <td> <nobr> <button type="submit">{{ __("Search") }}</button> </nobr> </td> </tr> </table> </form> {% if g.get.query is defined and g.get.query is not null and g.get.query != "" %} {% if ctx.posts|length > 0 %} <p>{{ __("%result_count% result(s) in %search_duration% second(s)", { "result_count": ctx.posts|length, "search_duration": ctx.search_duration|number_format(2, __(".", context: "Number formatting"), __(",", context: "Number formatting")), }) }}</p> {% for post in ctx.posts|filter(p => not p.deleted) %} {% set hasAttachments = ctx.attachments[post.id]|length > 0 %} {% set postAuthor = ctx.users[post.authorId] %} <font size="2"><b><a href="?_action=viewtopic&topic={{ post.topicId|url_encode }}#post-{{ post.id|url_encode }}">{{ renderPostSummary(post.content) }}</a></b></font><br> {{ __("posted by %author% on %post_date% in %topic%", { "author": '<b>' ~ (postAuthor ? postAuthor.displayName : __("unknown"))|e("html") ~ '</b>', "post_date": '<br><span class="_time">' ~ post.postDate.format("c")|e("html") ~ '</span>', "topic": '<br><font color="green">' ~ (ctx.topics[post.topicId].isLocked ? ('<img src="/ui/theme-files/old/lock_small.gif" class="inline-icon" width="10" height="10" draggable="false" alt="' ~ __("This topic has been locked") ~ '"> ') : '') ~ (ctx.topics[post.topicId] ? ctx.topics[post.topicId].title : null)|default(__("unknown"))|e("html") ~ '</font>', }) }} <br><br> {% endfor %} {% else %} <hr color="silver" noshade> <table cellspacing="0" cellpadding="4" bgcolor="lightskyblue" border="1" bordercolor="skyblue"> <tr><td> <img src="/ui/theme-files/old/information.gif" border="0" alt="" width="16" height="16" draggable="false" class="inline-icon"> {# #}{{ __("No results for this search") }} </td></tr> </table> <br> {% endif %} {% endif %} {% endblock %} {% block scripts %} {{ parent() }} {% if not (g.get.query is defined and g.get.query is not null and g.get.query != "") %} <script type="text/javascript"> $(function() { $("#i_query").focus(); }); </script> {% endif %} {% endblock %}