Is there a way to get the session id from craft.session in a twig template without needing to create a new filter?
2 Answers
Old post, I know, but we've recently published a plugin to achieve this for a similar problem we were facing.
SessionExposer plugin can help you achieve this. To get the Session ID in the template you use
{{ craft.sessionExposer.sessionId }}
I assume you're referring to the PHP session ID (wrapped by HttpSessionService)?
If so, the answer is no - Craft doesn't expose that to the templates. You'd have to write a plugin that did.
-
Yes, I has hoping to grab the session to send along for a unique identifier for some tracking purposes. Looked at the request.getCookie() also but no luck. May 28, 2015 at 14:34