开发者

Process Tags in Plugin

I have an Expression Eng开发者_运维知识库ine plugin that has a file parameter for example:

{exp:my_plugin file='/css/css.js'}

I can get the parameter in the plugin using

$file = $this->EE->TMPL->fetch_param('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'}

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);

You can find an example in https://github.com/pvledoux/Pvl_checkif/zipball/master

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜