How to use session on a view page phalcon I want to save specific value in new session variable
you can access session directly in your view Just print it out
{{ session.something }}
or something like this
{% if session.userid is 1 %} {{ 'is 1' }} {% else %} {{ 'Not 1' }} {% endif %}
i want to save into session not using volt
If you are using volt you are able to use service that you have define in depency container
here is some refence : https://docs.phalcon.io/en/latest/reference/volt.html#inject-services-into-a-template
If you wan set session within view
{{ session.set("key", "value") }}
if you dont want use vold you could access DI in static way fro your view
$session = Phalcon\DI::getDefault()->getSession(); $session->set("key", "value");
Why do you need to set session value in your view? It's probably not a good idea
I think you can just do it in your controller.
how to destroy session in a view itself
https://docs.phalcon.io/en/latest/api/Phalcon_Session_Adapter.html
{{ session.destroy() }} or $session->destroy();
{{ session.destroy() }}
$session->destroy();