在Smarty函数和块之间传递持久变量/类

I'm defining custom blocks and functions in smarty. Let's say my code in the template is like:

{myblock}
    {myfunction}
{/myblock}

Let's also say that {myblock} calls a PHP function (a static MyClass::create()) that creates and instance of MyClass.

How can I access THAT instance from the PHP code called by {myfunction}?

I've tried assigning the instance to a template variable, but the variable gets lost when i reference the template in myfunction. Same thing if I use a static property of MyClass. Any suggestions?

(Hope it's all clear...)

Edit: Both methods called by myblock and myfunction are static, I've used a private static $instances variable to try to hold the instances referenced by an id, where myblock puts the instance, but no luck as for now accessing the same static variable from myfunctions, it goes empty.