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.

How cookies SET in volt?

Hey guys!

I need set cookie in phalcon (don't ask "why" please). but i have a error: Invalid token SET.

{{cookies.set('refer', 123)}}

but GET cookie is OK. (not "refer", other).

How i can set cookie in volt?


I will still ask why. You should do it in controller action. Beacause cookies are send only if response is send. If you use view you don't have to return always response with it.

Just use RAW PHP; But I have to say it is bad code to have changes in the view.

<?php setcookie("refer", 123); ?>

I guess this is beacause set keyword is used in volt already. Like {% set variable = "asd"%} but it's just a guess.

thanks guys. forgot that you can do this in the controller, and made life difficult for yourself.