File: mainpage.qtpl

package info (click to toggle)
golang-github-valyala-quicktemplate 1.7.0%2Bds1-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 468 kB
  • sloc: xml: 15; makefile: 14
file content (31 lines) | stat: -rw-r--r-- 603 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
// Main page template. Implements BasePage methods.

{% import "github.com/valyala/fasthttp" %}

{% code
type MainPage struct {
	CTX *fasthttp.RequestCtx
}
%}


{% func (p *MainPage) Title() %}
	This is the main page
{% endfunc %}


{% func (p *MainPage) Body() %}
	<h1>Main page</h1>
	<div>
		Click links below:
		<ul>
			<li><a href="/table?rowsCount=42">Table page</a></li>
			<li><a href="/unknown-page">Error page</a></li>
		</ul>
	</div>
	<div>
		Some info about you:<br/>
		IP: <b>{%s p.CTX.RemoteIP().String() %}</b><br/>
		User-Agent: <b>{%z p.CTX.UserAgent() %}</b><br/>
	</div>
{% endfunc %}