Похожие чаты

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 ответов

25 просмотров
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- Автор вопроса

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

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

Господа, а что сейчас вообще с рынком труда на делфи происходит? Какова ситуация?
Rꙮman Yankꙮvsky
29
А вообще, что может смущать в самой Julia - бы сказал, что нет единого стандартного подхода по многим моментам, поэтому многое выглядит как "хаки" и произвол. Короче говоря, с...
Viktor G.
2
@Benzenoid can you tell me the easiest, and safest way to bu.y HEX now?
Živa Žena
20
This is a question from my wife who make a fortune with memes 😂😂 About the Migration and Tokens: 1. How will the old tokens be migrated to the new $LGCYX network? What is th...
🍿 °anton°
2
30500 за редактор? )
Владимир
47
а через ESC-код ?
Alexey Kulakov
29
What is the Dex situation? Agora team started with the Pnetwork for their dex which helped them both with integration. It’s completed but as you can see from the Pnetwork ann...
Ben
1
Гайс, вопрос для разносторонее развитых: читаю стрим с юарта, нада выделять с него фреймы с определенной структурой, если ли чо готовое, или долбаться с ринг буффером? нада у...
Vitaly
9
Anyone knows where there are some instructions or discort about failed bridge transactions ?
Jochem
21
@lozuk how do I get my phex copies of my ehex from a atomic wallet, to move to my rabby?
Justfrontin 👀
11
Карта сайта