We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

use, instanceof and constants

Hi there who can I do something like this in Volt

use \NS\MyClass;

if ($someVar instanceof MyClass)

{{ getElement(MyClass::MY_ELEMENT) }}

with that three sentences I get error

edited Nov '15

Accessing static objects from volt is not supported, you'll have to create an instantiated helper service for it.

I think you can also write plain PHP code in volt with the standard <?php ... ?> tags.

<?php
$someVar = 'foo bar';
?>

{{ someVar }}

Or just restructure you logic and handle it in the Controller.