We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Nesting tags question

Development and Programming

Mark Croxton's avatar
Mark Croxton
319 posts
about 16 years ago
Mark Croxton's avatar Mark Croxton

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?

       
Mark Croxton's avatar
Mark Croxton
319 posts
about 16 years ago
Mark Croxton's avatar Mark Croxton

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

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.