You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+7-5Lines changed: 7 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -76,12 +76,12 @@ Would be used like this in a pattern:
76
76
77
77
### Template inheritance
78
78
79
-
The requirements for using templateinheritance with Pattern Lab:
79
+
How to use [Template Inheritance](http://twig.sensiolabs.org/doc/templates.html#template-inheritance) with Pattern Lab:
80
80
81
-
* Files can optionally go in `source/_layouts` in order to hide them from the list of patterns.
82
-
* Files must have the extension `.twig`
83
-
* Files can be extended either by using Pattern Lab's normal shorthand syntax (e.g, `{% extends 'templates-extended-layout'%}`),
84
-
or, if they are in the `source/_layouts` directory, by using just the filename as reference (e.g., `{% extends 'extended-layout'%}`).
81
+
* Files must have the extension `.twig`.
82
+
* Files can be extended either by using Pattern Lab's normal shorthand syntax (e.g, `{% extends 'templates-extended-layout'%}`).
83
+
* Files can optionally go in `source/_layouts` in order to hide them from the list of patterns and then you can just use the filename as reference (e.g., `{% extends 'extended-layout'%}`).
84
+
* Files that are in the same directory can also just use the file name without the shorthand syntax (however, it must include the extension). So if `file1.twig` and `file2.twig` were in same directory, you could place this code in `file2.twig`: `{% extends 'file1.twig' %}`.
85
85
86
86
An example of a simple layout called `base.twig` in `source/_layouts`:
87
87
@@ -125,6 +125,8 @@ Would be used like this in a pattern:
125
125
{% endblock %}
126
126
```
127
127
128
+
All uses of `extends` above also work with `includes`, `embed` and most likely many other Twig Tags. Let us know if you run into interesting or unexpected use cases!
129
+
128
130
## Extending Twig Further
129
131
130
132
Twig comes with a number of ways to extend the underlying template parser. You can you can add [extra tags](http://twig.sensiolabs.org/doc/advanced.html#tags), [filters](http://twig.sensiolabs.org/doc/advanced.html#filters), [tests](http://twig.sensiolabs.org/doc/advanced.html#tests), and [functions](http://twig.sensiolabs.org/doc/advanced.html#functions). The Twig PatternEngine tries to simplify these extensions by allowing you to create files in specific folders and then auto-load the extensions for you. Learn more about:
0 commit comments