Skip to content

Commit c0a0810

Browse files
committed
go-aah/aah#217 docs update
1 parent 610fbdc commit c0a0810

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

template-funcs.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ By default Go lang provides set of [template functions](https://golang.org/pkg/t
1717
Function | Description | Example
1818
----------- | ----------- | --------
1919
config | Accessing application configuration from `aah.AppConfig()` | `{{ config "format.datetime" }}`
20-
include | Renders the common file from `views/common` with ViewArgs and imports into caller template file | `{{ include "sidebar.html" . }}`
2120
i18n | Access internationalization and localization message from view templates | `{{ i18n . "label.pages.title.aboutus" }}`
2221
pparam | Access Path parameter values | `{{ pparam . "userId" }}`
2322
fparam | Access Form parameter values | `{{ fparam . "email" }}`
2423
qparam | Access URL Query parameter values | `{{ qparam . "lang" }}`
2524
flash | Access Flash values. Note: Flash value is deleted after accessing once | `{{ flash . "error.user.email.incorrect" }}`
2625
session | Access Session object values | `{{ session . "Username" }}`
26+
include | Refer [here](#func-include) |
2727
rurl | Create Route URL, Refer [here](#func-rurl) |
2828
rurlm | Create Route URL, Refer [here](#func-rurlm) |
2929
isauthenticated | Refer [here](#func-isauthenticated) |
@@ -35,6 +35,26 @@ ispermittedall | Refer [here](#func-ispermittedall) |
3535
safeHTML | Refer [here](#func-safehtml) |
3636

3737

38+
#### Func: include
39+
40+
Include and render template file from anywhere under `<app-base-dir>/views/**` sub-tree with ViewArgs.
41+
42+
<span class="badge lb-sm">Since v0.12.0</span> new behaviour introduced.
43+
44+
```html
45+
{{ include "/common/sidebar.html" . }}
46+
47+
{{ include "/users/form.html" . }}
48+
```
49+
50+
Previous behaviour is deprecated, to be removed in subsequent future release.
51+
52+
```html
53+
<!-- from common directory -->
54+
{{ include "sidebar.html" . }}
55+
```
56+
57+
3858
#### Func: rurl
3959

4060
Creates the Route URL for the given route name with arguments. Additional arguments are discarded.

0 commit comments

Comments
 (0)