據this page documentatation,下面的代碼應該很好地工作:包含聲明如何在Twig中工作?
<div class="paginator">
<strong>pagina</strong>
<!-- Loop here -->
<a class="current "href="#">1</a>
<!-- End loop -->
<!-- This tag is only an example: --><a href="#">2</a>
{% include 'pagination.html.twig' with {
currentFilters: { myFilter: filtervariables },
currentPage: page,
paginationPath: "myroute",
lastPage: totalPages,
showAlwaysFirstAndLast: true
} only %}
</div>
但是它返回:
Unable to find template "pagination.html.twig" in something.html.twig at line (number).
的頁面是在同一個文件夾中pagination.html.twig
,所以我似乎無法到了解發生了什麼。有沒有人能解釋我發生了什麼?
在此先感謝。
應該只是返回'somefolder/template.html.twig'而不是'views/somefolder/template.htm.twig' – Barrosy
啊,不知道該標籤將被棄用,無法找到關於它的一個筆記http://twig.sensiolabs.org/doc/tags/include.html – Rvanlaak
嗯,其實,它不會被棄用。但它應該是;)(標籤不應輸出內容) – lyrixx