On Wed, Sep 5, 2012 at 12:04 PM, RoboTamer <
grue...@gmail.com> wrote:
> Following code gives me the error function "lower" not defined any idea why
> ?
> Everything works fine without the lower label in the template
When you post code for help you should include complete examples that
show the issues you're having.
The problem with posting vague parts of your code is that if you don't
know what the problem is then you also don't know what parts
of the code are relevant to the problem.
From what you posted I guessyou're not passing the template.FuncMap
you've created to the template you want to render.
http://golang.org/pkg/text/template/#Template.Funcs
But since you don't show that part of your code, I can't be much more helpful.
> type View struct {
>
> Func template.FuncMap
>
> }
>
>
> var V = new(View)
>
>
> func main() {
>
> V.Func = template.FuncMap{
>
> "lower": strings.ToLower,
>
> }
>
> }
>
>
> func genTemplate(w http.ResponseWriter, v *View) {
>
>
> }
>
>
> template looks like this:
>
>
> {{range .Menu}}<a href="/wiki/{{lower .}}" title="{{.}}"> {{.}}</a>{{end}}
>
>
--
=====================
http://jessta.id.au