簡體   English   中英

將Laravel分頁與Twig模板一起使用

[英]Using Laravel pagination with Twig templates

我在Laravel中使用了TwigBridge軟件包( barryvdh/laravel-twigbridge )。 一切工作正常,但是當我嘗試使用Twig模板渲染分頁鏈接時,原始HTML輸出。 我寫的links調用如下:

{{ users.links('includes.paginate') }}

我在app/views/includes/paginate.twig有一個模板文件。

我必須更改或添加一些配置嗎?

我不熟悉該軟件包(我使用的是rcrowe的軟件包),但查看其配置文件,我會看到:

 'options' => array(

    'autoescape' => 'html',

 )

* autoescape: Whether to enable auto-escaping (default to html):
| * false: disable auto-escaping
| * true: equivalent to html
| * html, js: set the autoescaping to one of the supported strategies
| * PHP callback: a PHP callback that returns an escaping strategy based on the template "filename"

一個不好的解決方案是關閉自動轉義,但這將是全球性的,並且可能以您不希望的方式影響您的應用程序。 您是否嘗試使用原始的 Twig過濾器?

{{ users.links('includes.paginate')|raw }}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM