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

prefix="" parameter for tag pairs (i.e. namespacing)

Feature Requests

Mark Croxton's avatar
Mark Croxton
319 posts
8 years ago
Mark Croxton's avatar Mark Croxton

For example:

{exp:my_tag prefix="my_prefix"}

  {!-- single variables --}
  {my_prefix:my_variable}


  {!-- variable pairs --}
  {my_prefix:my_variable_pair}
    {my_prefix:my_variable_pair:another_variable}
  {/my_prefix:my_variable_pair}

  {!-- not forgetting common iteration variables... --}
  {my_prefix:count}
  {my_prefix:absolute_results}

  {!-- ...and conditionals --}
  {if my_prefix:no_results}
     ...
  {/if}

  {if my_prefix:count > 3}
     ...
  {/if}

{/exp:my_tag}

I would suggest that the prefix parameter value - if it is set - is simply searched/replaced from ee()->TMPL->tagdata before the module/plugin tag itself is processed (so the module/plugin receives the tagdata with the prefix already removed). Therefore no change would be needed to any existing add-ons. It will “just work”. Possibly you could make it opt-in, via a setting for the add-on or a global config value.

This would solve significant parse order issues, and allow tags like channel:entries to be nested.

       
TJ Draper's avatar
TJ Draper
222 posts
8 years ago
TJ Draper's avatar TJ Draper

I was sure I had made this feature request but I can’t find it. I must have just talked to the team about it at some point.

In any event, I actually do it manually on all my tags. For instance, Construct defaults to the {contruct:var}. The only difference is I use the parameter namespace. If the official terminology becomes prefix I’ll go with it but I like namespace.

I definitely would not say no to this becoming a default thing I didn’t have to do.

       
Sobral's avatar
Sobral
86 posts
8 years ago
Sobral's avatar Sobral

This is one of the two things I most want to see on Template Class, after to allow arrays with arbitrary keys.

       

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.