如何从php文件中的集合变量动态设置包含文件?
<body>
{onload;file={tplvar.absopath}}
</body>因此,一旦加载了模板,$tbs->LoadTemplate($tpl)文件就应该生成构建在absopath指向的文件上的html。
发布于 2018-03-05 22:35:46
参数file可以在TBS模板中插入文件的内容。
示例
PHP侧:
$filename = 'header.html'; 模板侧:
[onload;file=[var.filename]] 请参阅参数文件
发布于 2018-03-05 22:20:37
如果您有一个包含文件名的变量,那么您可以在require或include (带或不带_once)中使用该变量。
例如:
<?php
$template = __DIR__.'/templates/header.php';
require_once $template;差不多吧。
这将是一个非常粗糙的方式,包括一个模板文件,但它是尽可能简单的。
https://stackoverflow.com/questions/49120395
复制相似问题