在FatFree中的html模板中呈现字符串

时间:2018-01-16 04:45:13

标签: php fat-free-framework

我有一个html文件,其中fatfree从.html文件呈现html代码。例如,.html文件具有以下代码;

<include href='navigation.html'>
<include href='{{ @view }}>

其中view包含.html文件的路径。

但在我的情况下,html代码由程序生成为字符串类型。如何在fatfree中将这样的字符串呈现为html,如。

<div>{{ @view }}</div>

1 个答案:

答案 0 :(得分:1)

查看https://fatfreeframework.com/3.6/views-and-templates#Extendingfiltersandcustomtags

您可以使用过滤器来使用原始HTML代码而不是使用<div>{{ @view|raw }}</div>转义(用于安全性)版本。

或者你可以禁用一般的转义,这是非常不鼓励的。

$f3->set('ESCAPE',FALSE);