I’m trying to set some parameters of a tag by wrapping it in a custom plugin that I’ve called ‘ranges’, eg:
{exp:ranges}
{exp:weblog:entries weblog="products" dynamic="off" category="{range_id}&{cat_id}"}
{title}
{/exp:weblog:entries}
{/exp:ranges}
I want to replace (range_id} and {cat_id} within my ranges plugin. This doesn’t work..
$tagdata = $TMPL->tagdata;
$tagdata = str_replace('{range_id}', '63', $tagdata);
$this->return_data = $tagdata;
Could anyone explain how this is normally done in EE?
Aha I’ll answer my own question.
It works if you add parse=”inward” to the plugin tag:
{exp:ranges parse="inward"}
{exp:weblog:entries weblog="products" dynamic="off" category="{range_id}&{cat_id}"}
<li>{title}</li>
{/exp:weblog:entries}
And it also works like this:
{exp:weblog:entries weblog="products" dynamic="off" category="{exp:ranges:my_method}" parse="inward"}
<li>{title}</li>
{/exp:weblog:entries}
(..and if anyone who has used modx is reading this, this gives you pretty much the same functionality as nesting snippets inside snippet parameters.)
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.