weiter an der funktionalität der events gearbeitet

This commit is contained in:
xoy 2023-01-28 20:16:03 +01:00
parent 309fdcf175
commit 1e4c367836
1 changed files with 12 additions and 2 deletions

14
func.go
View File

@ -146,10 +146,20 @@ func htmlReplacer(input string, activePage string) string {
events := getEvents() events := getEvents()
if len(events) == 0 { if len(events) == 0 {
output = strings.ReplaceAll(output, "!EVENTS", htmlNewBanner("Rundgang", "https://www.chaostreff-dortmund.de/rundgang/")) output = strings.ReplaceAll(output, "!EVENTS", htmlElement("h4", "Keine Events in der nächsten Zeit!", ""))
} else { } else {
tempA, tempB := "", ""
for i, Event := range events {
if i == 24 {
break
}
output = strings.ReplaceAll(output, "!EVENTS", htmlNewBanner("Rundgang", "https://www.chaostreff-dortmund.de/rundgang/")) tempA = htmlElement("h2", Event.title, "")
tempA += htmlElement("p", Event.description, "")
tempA += htmlElement("p", Event.date, "")
tempB += htmlElement("div", tempA, "class=\"event\"")
}
output = strings.ReplaceAll(output, "!EVENTS", tempB)
} }
output = strings.ReplaceAll(output, "!NEWBANNER", htmlNewBanner("Rundgang", "https://www.chaostreff-dortmund.de/rundgang/")) output = strings.ReplaceAll(output, "!NEWBANNER", htmlNewBanner("Rundgang", "https://www.chaostreff-dortmund.de/rundgang/"))