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

What is the difference between volt files and phtml files?

What is the difference between volt files and phtml files?



5.2k
Accepted
answer

phtml is a template engine uses raw php,

example in phtml:

<?php echo $this->tag->form('/login'); ?>
    <?php echo $form->render('email'); ?>
<?php echo $tihs->tag->endForm(); ?>

volt is a template engine uses volt syntax (support also raw php):

example in volt:

{{ form('/login') }}
    {{ form.render('email') }}
{{ endform() }}

More about volt: https://docs.phalcon.io/en/latest/reference/volt.html

You can configure Phalcon to treat both of them identically. All my template files have a .phtml extension. but I use Volt syntax in them.

i can use volt template .volt extension, and use php syntax ? is the same?