At the moment the system gets confused if I call the same plugin within itself. I wanted to do this in the yui plugin, eg.
{exp:yui:load:tabs ....}
{tab}
....
{exp:yui:load:calendar ..}{/exp:yui:load}
{/tab}
{tab}
...
etc.
{/tab}
{/exp:yui:load}
Looking at core.template.php it is searching for the first instance of the closing tag. I changed it to look for the last instance and it seems to work, but it may break something else! Be good to be able to nest plugins.
Code changed on line 690 to use strrpos instead of strpos:
$out_point = strrpos($this->fl_tmpl, $cur_tag_close);
[Mod edit: Moved to plugin support forum as this feature already exists]
Take 2:
// need to decide if looking for first or last instance of the tag.
// if there is another opening of this same tag before the next closing one, then look for the last tag
$first_open=&strpos;($this->fl_tmpl,LD.$tag);
$first_close= &strpos;($this->fl_tmpl, $cur_tag_close);
if ($first_close<$first_open)
$out_point=$first_close;
else
$out_point = strrpos($this->fl_tmpl, $cur_tag_close);
Of course you can nest plugins (see Nested Plugins heading). Explain what you mean by “At the moment the system gets confused”.
You can’t nest a call to the same function in the plugin as it assumes that the next closing tag for this plugin/function is the correct one.
This works: {exp:myplugin:func1}
{exp:myplugin:func2}
{/exp:myplugin:func2}
{/exp:myplugin:func1}
This does not
{exp:myplugin:func1}
{exp:myplugin:func1}
{/exp:myplugin:func1}
{/exp:myplugin:func1}
You could argue that this is bad plugin design to want to call nested functions…
You could argue that this is bad plugin design to want to call nested functions…
Yes, lol. I didn’t catch that you were using the same method, as the tags had an additional segment. I instantly read it as calling ‘tabs’, ‘calendar’, etc. of your ‘load’ plugin. But to give specific advice, I’d need to have a better of idea of what problem you are solving that led you to try that in the first place.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.