Hi -
I’m writing my first plugin and I’m having trouble with no_results functionality. The problem only occurs when my tag is nested in another tag. Most notably weblog:entries:
The following outputs ‘Nothing found.’
<div>{exp:retail_locator:results}{if no_results}Nothing found.{/if}{/exp:retail_locator:results}</div>
This is expected since the plugin function results currenly just call $TMPL->no_results(); … I’m just testing.
The following doesn’t output anything
{exp:weblog:entries weblog="pages" limit="1"}
<div>{exp:retail_locator:results}{if no_results}Nothing found.{/if}{/exp:retail_locator:results}</div>
{/exp:weblog:entries}
I assume the output is blank because EE interpreted the no_results condition for the weblog:entries tag scope and since the entry was found no_results doesn’t apply and so it’s not output.
I’ve proven this theory by doing this: The following outputs ‘Nothing found.’
{exp:weblog:entries weblog="pages" limit="1"}
{if no_results}No such blog entry.{/if}
<div>{exp:retail_locator:results}{if no_results}Nothing found.{/if}{/exp:retail_locator:results}</div>
{/exp:weblog:entries}
This makes my tag work nested inside weblog:entries.
So the 500 million dollar question is: is there anything that I can work around here? Or do I need to provide my own no_result functionality? What gives?
Thanks, Juergen
Ok, after some more searching I found the answer here:
http://ellislab.com/forums/viewthread/91543/
Fine, I can agree with Derek on this. But I now have to ask another related question:
Does EE provide a global memory caching / registering facility?
I know I can create my own and I can use global variables. Of course, I try to avoid this. There’s just so much to read and learn about EE right now that I’m taking the opportunity to ask experienced EE users for tried and true approaches.
The way I’d use such a (non-persistent) cache would be primarily to avoid having to recast my queries all the time when my plugin tag is called repeatedly (due to flattening the nesting) of container tags.
Thanks for any advice, Juergen
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.