Похожие чаты

Hello. I'm experiencing a strange issue with Go templates. I

have two base layouts base.tmpl and auth.tmpl

I have pages that "extend" these layouts. E.g index.tmpl extends base and login.tmpl extends auth.

No matter what route I visit, the last alphabetical template is always rendered in the layout. What's going wrong here?

e.g if I visit login, it should render login.tmpl within auth.tmpl, but register.tmpl is rendered instead.

6 ответов

9 просмотров
pete- Автор вопроса

I've trimmed it down to one base layout, and now whatever page I visit, I get the contents of register.tmpl. (register.tmpl is alphabetically the last template) In case it is of any use, I'm using Go 1.14.2. If anyone could even point me in the right direction, that would be great, I don't even know what to search for at this point.

can’t tell, you didn’t show any code, could be anything

pete- Автор вопроса
Roman Sharkov
can’t tell, you didn’t show any code, could be any...

My templates are similar to the following base.tmpl: {{ define "base" }} <html> ... {{ template "main" . }} ... </html> {{ end }} index.tmpl: {{ template "base" . }} {{ define "main" }} ... {{ end }} main.go: import "html/template" ... template.Must(template.ParseGlob("views/*/*.tmpl"))

pete- Автор вопроса

Похожие вопросы

Обсуждают сегодня

Всем привет, написал код ниже, но он выдает сегфолт, в чем причина? #include <stdio.h> #include <stdlib.h> #include <string.h> struct product { char *name; float price; };...
buzz базз
60
Хотел бы спросить у знающих, правильную ли я выбрал книгу для начала изучения ассемблера Юрова В.И ? Или есть более лучшие книги для начала обучения?
Botsman
25
Добрый день, не подскажите, если в OC-V3 поменять страндартную директорию /storage/ на /storage2/ - не будет сильно много проблем ?
Max Dubovsky
32
Conversation at a festival with a non-crpto person (not a normie by any stretch, though): * person: tell me about crypto, me: ok, the original idea is p2p sound money for the...
molecular#123 🐓
25
Книга Юрова В.И пойдёт для обучения?
Botsman
24
$params = [ 'formid' => 'feedbackForm', 'formTpl' => '@CODE: <form class="form-validate" data-id="ajax_form"> <fieldset class="margin-bottom-md"> ...
Pathologic
1
> Примечательно, что новый владелец удаляет из GitHub любые жалобы, указывающие на подозрительную активность или смену владельца, и, видимо, рассчитывает на то, что пользовате...
Alex Sherbakov
2
Today, DENT achieved a significant step forward in DENTX adoption 🥳 Getting DENTX and starting staking is much easier: DENTX is available on Uniswap! Everyone can swap their ...
Thomas
3
I bought some PHA tokens on Kucoin, which is the best wallet to store and easy to use?
AMR
19
Hey there Which is the best Linux destro for developers (coding)? To my research on reddit, they said Linux mint is good for mid level spec and Ubuntu for high Lev hardwar...
Wiz 🪄
11
Карта сайта