插件中的处理标签 [英] Process Tags in Plugin
本文介绍了插件中的处理标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个Expression Engine插件,该插件具有一个文件参数,例如:
I have an Expression Engine plugin that has a file parameter for example:
{exp:my_plugin file='/css/css.js'}
我可以使用
$file = $this->EE->TMPL->fetch_param('file');
有没有一种方法可以处理$file
来替换所有标签,即全局变量和摘要,以便我可以执行以下操作:
Is there a way to process $file
to replace any tags, i.e. global variables and snippets, so that I could do something like:
{exp:my_plugin file='{global_path}/css.js'}
{global_path}
是否已用全局路径的值替换?
And have {global_path}
be replaced with the value of global path?
推荐答案
在插件中,您可以解析参数以匹配全局变量:
In your plugin, you can parse the parameter to match global variables:
$value = $this->_ee->TMPL->fetch_param('value', '');
$value = $this->_ee->TMPL->parse_globals($value);
您可以在 https://github.com/pvledoux/Pvl_checkif/zipball/master 中找到示例
这篇关于插件中的处理标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文