当使用 $smarty->fetch 时,它会将模板拉入一个变量中。有没有办法对该变量进行预解析的字符串操作?
例子:
PHP:
$variable = $smarty->fetch('template.tpl');
$variable = str_replace("{include file='../another_dir", "{include file='", $variable);
模板.tpl
{include file='incl.tpl'}
理想的结果是让模板变成:
{include file='../another_dir/incl.tpl'}