Re: [go-nuts] template

2020-07-23 Thread Tharaneedharan Vilwanathan
Hi Lutz, Sorry I was not clear earlier. Yes, this is regarding Go HTML template. We use beego and HTML templates under that. We generally use nested templates in which we have nested if conditions as needed and for loop (range). We also do some minor computation, etc. I feel over time, the temp

Re: [go-nuts] template

2020-07-22 Thread Lutz Horn
I am running a website for which we use templates. Do you use https://golang.org/pkg/html/template/? If yes, how do you use them? If no, this question is off-topic for this mailing list. Lutz -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. T

[go-nuts] template

2020-07-21 Thread Tharaneedharan Vilwanathan
Hi All, I am running a website for which we use templates. While I see the benefit of templates, I also notice that it has gotten ugly over time. So, here are my questions: - Are templates popular? Or do you avoid using it? - Any do's and don'ts? Any best practices? - Any suggestions on formatt

[go-nuts] Template function arguments from JS

2018-10-17 Thread Volodymyr Salo
Hi! I have some template which gets populated based on some function, but the latter gets an argument from javascript code, defined in the same template. Of course, it doesn't work, as js code doesn't get executed within the template context. Code is as follows: function getMonth() {

Fwd: [go-nuts] Template func ParseFiles, parsing multiple files

2017-07-13 Thread Tong Sun
Thanks a lot Nathan. -- Forwarded message -- From: Nathan Kerr Date: Thu, Jul 13, 2017 at 3:48 AM Subject: Re: [go-nuts] Template func ParseFiles, parsing multiple files To: Tong Sun MyTempl will have different templates after the second call. The template called “tf1” from the

[go-nuts] Template func ParseFiles, parsing multiple files

2017-07-05 Thread Tong Sun
What would it happen if I pass two or more files to: func (*Template) ParseFiles func (t *Template ) ParseFiles(filenames ...string

[go-nuts] template Funcs with ParseFile and Execute

2017-03-26 Thread Lee McLoughlin
Try changing the call to New to name the template the same as the first parameter to ParseFiles t, _ := template.New(templates.BASE).Funcs(funcMap).ParseFiles(templates.BASE, templates.NOTIFICATIONS, templates.TICKER, templateName) There is something odd about how ParseFiles works if the name i

Re: [go-nuts] template Funcs with ParseFile and Execute

2017-03-25 Thread Rob Pike
Please check the error on the line that calls template.New. I believe it's reporting failure. -rob On Sat, Mar 25, 2017 at 9:56 AM, priyank pulumati < pulumati.priy...@gmail.com> wrote: > Sry for little info, template.Base is a constant ("templates/base.html", a > path) and the same for templat

Re: [go-nuts] template Funcs with ParseFile and Execute

2017-03-25 Thread priyank pulumati
Sry for little info, template.Base is a constant ("templates/base.html", a path) and the same for templateName passed from my controller. But what do i pass in template.New() ? On Saturday, March 25, 2017 at 10:17:23 PM UTC+5:30, Yves Junqueira wrote: > > Your ParseFiles call has a "templateName"

Re: [go-nuts] template Funcs with ParseFile and Execute

2017-03-25 Thread priyank pulumati
Sry for little information, templateName is passed from my controllers with a constant (like "templates/home.html"), so there is no problem with that. In template.new(), what do i pass ? On Saturday, March 25, 2017 at 10:17:23 PM UTC+5:30, Yves Junqueira wrote: > > Your ParseFiles call has a "tem

Re: [go-nuts] template Funcs with ParseFile and Execute

2017-03-25 Thread Yves Junqueira
Your ParseFiles call has a "templateName" argument in it. The ParseFiles function only takes file paths, not template names. And templates.New takes a template name, not a file path. Hope this helps. On Sat, Mar 25, 2017 at 9:14 AM, priyank pulumati < pulumati.priy...@gmail.com> wrote: > hello,

[go-nuts] template Funcs with ParseFile and Execute

2017-03-25 Thread priyank pulumati
hello, im building a go web app and facing an issue with Executing templates with custom functions func CustomTemplateExecute(res http.ResponseWriter, req *http.Request, templateName string, data map[string]interface{}) { // Append common templates and data structs and execute template var funcM

RE: [go-nuts] template Inheritance

2016-11-18 Thread dhal.asitk
have attempted to imitate jinja in Golang. Warm Regards, Asit Dhal http://asit-dhal.github.io/ From: Manlio Perillo Sent: Wednesday, November 16, 2016 17:26 To: golang-nuts Subject: [go-nuts] template Inheritance I'm trying to use the new block action in the template package but I'm no

[go-nuts] template Inheritance

2016-11-16 Thread Manlio Perillo
I'm trying to use the new block action in the template package but I'm not sure to understand how it should be use. What I would like to do is something like template inheritance support in Jinja templating: http://jinja.pocoo.org/docs/dev/templates/#template-inheritance Thanks Manlio -- Yo