在Twig模板中使用Laravel分页


Using Laravel pagination with Twig templates

我使用TwigBridge包(barryvdh/laravel-twigbridge)与Laravel。一切都很好,但当我试图使用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 }}