Volt function to return html

Hey Guys,

I'm wondering what is the correct way to write a function that extends volt that returns html.

I've tried:

$compiler->addFunction( "latestFeed", function ($resolvedArgs, $exprArgs) use ($compiler) { return "<div>Yo</div>"; });

But it always errors with a parser error: Parse error: syntax error, unexpected '<'

Cheers, Ben

Please note the quotes:

// Filter / Modifier
$compiler->addFilter('prettyDate', function($resolvedArgs, $exprArgs){
    return 'Helpers\Volt::prettyDate(' . $resolvedArgs . ')';

// Function
$compiler->addFunction('getUpload', function($resolvedArgs, $exprArgs){
    return 'Helpers\Common::getUpload(' . $resolvedArgs . ')';


You could also add your own class holding methods instead of using anonymous functions.


$objDi->set('StringFunctions', function() {
    return new \StringFunctions();


class StringFunctions extends \Phalcon\Tag
      public function foo($text) 
            return "<div>". htmlspecialchars($text) ."</div>";


public function somethingAction()
       $this->view->someText = "Yo";


{{ StringFunctions.foo(someText) }}