Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to show multi variables in tmpl file? #44

Open
lmquang opened this issue Jan 25, 2015 · 2 comments
Open

How to show multi variables in tmpl file? #44

lmquang opened this issue Jan 25, 2015 · 2 comments

Comments

@lmquang
Copy link

lmquang commented Jan 25, 2015

This is my code:
location := Place{}
location.region , location.city = getLocation(params["code"])
r.HTML(200, "home/place", location)

When i code : {{.}} , then it shows {abc def }
But I wanna show somethings like:
My region: {{ .region }}
My city : {{ .city }}
But i can't. So, can you show me how to do that ? Thank you

@unknwon
Copy link

unknwon commented Jan 28, 2015

I think lowercase fields will not be displayed as the Go rules defined.

So you first need to change region to Region, then use {{.Region}}.

Hope helps.

@avdept
Copy link

avdept commented May 17, 2015

lower case fields are like private, can be used only where they defined, while uppercase - are "exported" and can be used anywhere

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants