更改 ExpressionEngine 插件的解析顺序

发布于 2024-12-20 03:14:03 字数 487 浏览 6 评论 0原文

我在模板中有以下 ExpressionEngine 代码:

{exp:hits:count_hits_image entry_id='{exp:test:getpage tag="id"}'}

其中 exp:test 是我创建的一个插件,用于获取 频道条目 ID

我遇到的问题是 exp:hits 是在 exp:test 之前解析的,这使得整个标签无法正常工作。

我该怎么做才能告诉 ExpressionEngine 在解析外部标记 {exp:hits} 之前先解析内部标记 {exp:test}

I have the following ExpressionEngine code in a template:

{exp:hits:count_hits_image entry_id='{exp:test:getpage tag="id"}'}

Where exp:test is a plugin I created to get a channel entry's ID.

The problem I'm having is that exp:hits is being parsed before exp:test, which makes the whole tag disfunctional.

What can I do to tell ExpressionEngine to parse the inside tag first {exp:test}, before parsing the outside tag {exp:hits}?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

你需要做的是将你的插件变成一个标签对,所以它的工作原理如下:

{exp:test:getpage tag="id" parse="inward"}
    {exp:hits:count_hits_image entry_id='{id}'}
{/exp:test:getpage}

在你的插件中你会做这样的事情:

$vars = array();
$vars[0]['id'] = $results->row('id');
return $this->EE->TMPL->parse_variables($this->EE->TMPL->tagdata, $vars);

What you need to do is turn your plugin into a tag pair, so it works like this:

{exp:test:getpage tag="id" parse="inward"}
    {exp:hits:count_hits_image entry_id='{id}'}
{/exp:test:getpage}

In your plugin you'd do something like this:

$vars = array();
$vars[0]['id'] = $results->row('id');
return $this->EE->TMPL->parse_variables($this->EE->TMPL->tagdata, $vars);
预谋 2024-12-27 03:14:03

试试这个:

{exp:hits:count_hits_image entry_id='{exp:test:getpage tag="id"}' parse="inward"}

Try this:

{exp:hits:count_hits_image entry_id='{exp:test:getpage tag="id"}' parse="inward"}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文