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.
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.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.