gobuffalo / plush

The powerful template system that Go needs
MIT License
895 stars 57 forks source link

access session variable from helper func #27

Closed mbetel closed 6 years ago

mbetel commented 6 years ago

Is there a way to get access to the session variables in a helper function? Or am I overlooking something dumb? :)

markbates commented 6 years ago

You can access the session in a template using the session variable. <%= session.Get(“foo”) %>

mbetel commented 6 years ago

Thanx thats good to know, but what I meant was accessing them via the plush.HelperContext without exposing them to the user, Is that possible?

markbates commented 6 years ago

Everything that’s in the context is available in the HelperContext. help.Value(“session”).(*buffalo.Session) don’t quote me on the casting there. I can’t remember the exact type right now.