Changing an ExpressionEngine Plugin's Parse Order
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}
?
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);
尝试这个:
{exp:hits:count_hits_image entry_id='{exp:test:getpage tag="id"}' parse="inward"}
链接地址: http://www.djcxy.com/p/66016.html