Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Could not use my own view helper in Volt

Hi, I write my own view helper as below:

namespace Tartan;

class Tag extends \Phalcon\Tag
    static public function gtoj($date)
        return $response;

then I added my own tag service in DI in my application bootstrap:

$di->set('tag', function() {
    return new \Tartan\Tag();

NOW, I can use my helper like below and it works perfectly

<?php echo $this->tag->gtoj('2014-03-03'); ?>

but I can`t use it in Volt like

{{ gtoj("2014-03-03") }}

and I got following error:

Phalcon\Mvc\View\Exception: Undefined function 'gtoj' in /home/aboozar/www/2013/blue/app/modules/Panel/views/merchant/index.phtml on line 17

other tag helpers like {{ link_to("products/search", "Search") }} works in the same file too.

any Idea?



take a look at this page, you'll find your answer :


You can use it in volt like

 {{ tag.gtoj("2014-03-03") }}
edited Mar '14

Dear @Ivan Vorontsov your answer is correct. Thank you. but how I can accept your answer? "Accept answer" button doesn`t show in your reply!!!

(I can see only Reply/Disike/Like buttons) I thinks this is a forum bug.