插件中的过程标签

Ben*_*Ben 1 php expressionengine

我有一个Expression Engine插件,它有一个文件参数,例如:

{exp:my_plugin file='/css/css.js'}
Run Code Online (Sandbox Code Playgroud)

我可以使用插件获取参数

$file = $this->EE->TMPL->fetch_param('file');
Run Code Online (Sandbox Code Playgroud)

有没有办法处理$file替换任何标签,即全局变量和片段,以便我可以做类似的事情:

{exp:my_plugin file='{global_path}/css.js'}
Run Code Online (Sandbox Code Playgroud)

并且已{global_path}被全球路径的价值所取代?

pvl*_*oux 6

在您的插件中,您可以解析参数以匹配全局变量:

$value = $this->_ee->TMPL->fetch_param('value', '');
$value = $this->_ee->TMPL->parse_globals($value);
Run Code Online (Sandbox Code Playgroud)

您可以在https://github.com/pvledoux/Pvl_checkif/zipball/master中找到示例