4

Is there a way to get the session id from craft.session in a twig template without needing to create a new filter?

3

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 }}
| improve this answer | |
1

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.

| improve this answer | |
  • 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. – Derrick Grigg May 28 '15 at 14:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.