开发者

Process Tags in Plugin

开发者 https://www.devze.com 2023-04-12 22:06 出处:网络
I have an Expression Eng开发者_运维知识库ine plugin that has a file parameter for example: {exp:my_plugin file=\'/css/css.js\'}

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

精彩评论

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

关注公众号