So far as I know, a callback used in a template has to return what you want to display (a string, a rendered template or HTML created in PHP) or NULL. And you can't use it to set a variable value in a template.
Your PHP would look something like this...
Code:
public static function getIsAmp($contents, $params)
{
.... do whatever ...
if($result_from_whatever)
{
$value = '<span class="aclass">' . $result_from_whatever . '</span>';
}
else
}
$value = null;
}
return $value;
}
So, your template would look something like this...
I solved by making the HTML with the PHP callback, just another question:
You said that I cannot use xf:set variables got by a php callback, but if I just use them with {$var} I can see them in the HTML.
Also, in your case you are creating the "XXXX" inside the PHP, and the YYYY from the template, right?
That is why you can't assign a variable value from a callback. If it returns something other than what is to be displayed, you get this as the value...