包含一个位于 web 文件夹中的模板 [英] Include a template which is in the web folder

查看:29
本文介绍了包含一个位于 web 文件夹中的模板的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个网站,让人们上传自己的树枝模板.这些模板文件存储在 web 文件夹中.

I am creating a website in which I let people upload their own twig templates. These template files are stored into the web folder.

如何将其中一个文件包含在另一个模板中.

How can I include one of those files in another template.

我试过了:

{% include dirname(__FILE__) ~ '/../../../../web/designs/' ~ target.design.filekey ~ '/DesignKit/design.html.twig' %}

但我收到一个错误,指出 dirname 函数不存在.

But I get an error telling that the dirname function does not exist.

感谢您的帮助:)

推荐答案

use:

{% include '@web_dir/build/templates/templates.html.min.twig' %}

# config.yml
twig:
    paths:
        "%kernel.root_dir%/../web": web_dir

这篇关于包含一个位于 web 文件夹中的模板的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆