在 FatFree 的 html 模板中呈现字符串
Rendering string in html template in FatFree
我有一个 html 文件,其中 fatfree 从 .html 文件中呈现 html 代码。例如,.html 文件有以下代码;
<include href='navigation.html'>
<include href='{{ @view }}>
其中视图包含 .html 文件的路径。
但在我的例子中 html 代码是由程序生成的字符串类型。如何在 fatfree 中呈现 html 这样的字符串。
<div>{{ @view }}</div>
看看https://fatfreeframework.com/3.6/views-and-templates#Extendingfiltersandcustomtags
您可以使用过滤器来使用原始 HTML 代码,而不是使用 <div>{{ @view|raw }}</div>
的转义(为了安全)版本。
或者您可以禁用一般的转义,这是非常不鼓励的。
$f3->set('ESCAPE',FALSE);
我有一个 html 文件,其中 fatfree 从 .html 文件中呈现 html 代码。例如,.html 文件有以下代码;
<include href='navigation.html'>
<include href='{{ @view }}>
其中视图包含 .html 文件的路径。
但在我的例子中 html 代码是由程序生成的字符串类型。如何在 fatfree 中呈现 html 这样的字符串。
<div>{{ @view }}</div>
看看https://fatfreeframework.com/3.6/views-and-templates#Extendingfiltersandcustomtags
您可以使用过滤器来使用原始 HTML 代码,而不是使用 <div>{{ @view|raw }}</div>
的转义(为了安全)版本。
或者您可以禁用一般的转义,这是非常不鼓励的。
$f3->set('ESCAPE',FALSE);