Skip to content

Latest commit

 

History

History
16 lines (12 loc) · 674 Bytes

twig.md

File metadata and controls

16 lines (12 loc) · 674 Bytes

Twig

This bundle provides a SearchExtension that allows you to trigger search directly in your templates.

{# templates/home.html.twig #}
{% set movies = search('movies', 'green line') %} {# movies will contain a SearchResult object that can be iterated #}

{% for search('movies', 'green line') as movies %} {# A shorter approach could be to use it with for #}
    {{ movies['title'] }}
{% endforeach %}

Note: As The SearchExtension is lazy-loaded, the impact on performances should be minimal, keep in mind that fetching the MeiliSearch API's done via HTTP, a small latency can occur