Closed speedwheel closed 6 years ago
You can expose that struct via package and access it via package in the template. Just like the you do in golang.
Your are right, thanks!
What if I have a global value that is dynamic? for example some user session values that I want to send in all the templates?
Let's say we have a struct with some global static values and we have to send this values to all the pages, should we include this struct on each func? for example:
template.User(GlobalStatic, UserData buffer) template.Order(GlobalStatic, OrderData buffer) template.Product(GlobalStatic, ProductData buffer) etc...
It's this the right way?