not in template
i have function in MyAddOn_Model_thread
i need to compile template inside php and return its contents to vatiable
some thing like $html = eval(template)
You shouldn't be doing it in a model. You should be doing it in a view or hook that is at the view stage. You can use the template hooks to get an instance of XenForo_Template_Abstract and the use create() to make your template. Or you can do it in a view and use $this->createTemplateObject().
not in template
i have function in MyAddOn_Model_thread
i need to compile template inside php and return its contents to vatiable
some thing like $html = eval(template)
Yeah. That kind of eval is not necessary in XenForo. The "include" syntax has replaced it.
Edit the template in question... the template where you would normally include $html. Instead of $html use this template syntax to include the template you want to eval:
There are many reasons you might want to store a rendered template in a varible. I recently did it because of a system I made had different types. So you called $handlerInstance->render(). In render it create an instance of the template for that handler. This is called from within the template hook listener and will match certain hooks.
i make add-on to me
when click stick in thread i get title, 5 lines from contents and first image in attachment ans store it in notice to appear only in forum have this thread
but i need to style this contents because notices accept html content so i need to compile template and store its html in my notice
public static function templateHook($name, &$contents, array $params, XenForo_Template_Abstract $template)
{
// whatever
$temp_contents = $template->create('my_own_template', $template->getParams());
/* now that we have our custom template into $temp_contents, let's append it to $contents */
$contents = $contents . $temp_contents;
// whatever
}
And create a listener for the class where this function is in ..