Skip to content

Commit 0a4b15e

Browse files
committed
class
1 parent c409877 commit 0a4b15e

File tree

18 files changed

+295
-0
lines changed

18 files changed

+295
-0
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package main
2+
3+
import (
4+
"log"
5+
"os"
6+
"text/template"
7+
)
8+
9+
func main() {
10+
tpl, err := template.ParseGlob("templates/*/*.gohtml")
11+
if err != nil {
12+
log.Fatalln(err)
13+
}
14+
15+
err = tpl.Execute(os.Stdout, nil)
16+
if err != nil {
17+
log.Fatalln(err)
18+
}
19+
20+
err = tpl.ExecuteTemplate(os.Stdout, "vespa.gohtml", nil)
21+
if err != nil {
22+
log.Fatalln(err)
23+
}
24+
25+
err = tpl.ExecuteTemplate(os.Stdout, "two.gohtml", nil)
26+
if err != nil {
27+
log.Fatalln(err)
28+
}
29+
30+
err = tpl.ExecuteTemplate(os.Stdout, "one.gohtml", nil)
31+
if err != nil {
32+
log.Fatalln(err)
33+
}
34+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
******
2+
VESPA
3+
******
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
******
2+
TWO
3+
******
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
******
2+
ONE
3+
******

000_temp/46_sp17/25/main.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package main
2+
3+
import (
4+
"net/http"
5+
"text/template"
6+
)
7+
8+
var tpl *template.Template
9+
10+
func init() {
11+
tpl = template.Must(template.ParseGlob("templates/*.gohtml"))
12+
}
13+
14+
func main() {
15+
http.HandleFunc("/", index)
16+
http.HandleFunc("/about", about)
17+
http.ListenAndServe(":8080", nil)
18+
}
19+
20+
func index(w http.ResponseWriter, r *http.Request) {
21+
tpl.ExecuteTemplate(w, "index.gohtml", nil)
22+
}
23+
24+
func about(w http.ResponseWriter, r *http.Request) {
25+
tpl.ExecuteTemplate(w, "about.gohtml", nil)
26+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>About</title>
6+
</head>
7+
<body>
8+
9+
<h1>www.greatercommons.com</h1>
10+
11+
</body>
12+
</html>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Index</title>
6+
</head>
7+
<body>
8+
9+
Welcome to our website!
10+
11+
</body>
12+
</html>

000_temp/46_sp17/26/main.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package main
2+
3+
import (
4+
"net/http"
5+
"text/template"
6+
)
7+
8+
var tpl *template.Template
9+
10+
func init() {
11+
tpl = template.Must(template.ParseGlob("templates/*.gohtml"))
12+
}
13+
14+
func main() {
15+
http.HandleFunc("/", index)
16+
http.HandleFunc("/about", about)
17+
http.ListenAndServe(":8080", nil)
18+
}
19+
20+
func index(w http.ResponseWriter, r *http.Request) {
21+
tpl.ExecuteTemplate(w, "index.gohtml", false)
22+
}
23+
24+
func about(w http.ResponseWriter, r *http.Request) {
25+
tpl.ExecuteTemplate(w, "about.gohtml", nil)
26+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>About</title>
6+
</head>
7+
<body>
8+
9+
<h1>www.greatercommons.com</h1>
10+
11+
</body>
12+
</html>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Index</title>
6+
</head>
7+
<body>
8+
9+
{{if .}}
10+
<h1>Welcome to our website!</h1>
11+
{{end}}
12+
13+
</body>
14+
</html>

0 commit comments

Comments
 (0)