Skip to content

Commit 94923e9

Browse files
committed
Updating Template Inheritance docs
1 parent 16ed789 commit 94923e9

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ The Twig PatternEngine comes pre-installed with the [Pattern Lab Standard Editio
1111
Pattern Lab PHP uses [Composer](https://getcomposer.org/) to manage project dependencies with Pattern Lab Editions. To add the Twig PatternEngine to the dependencies list for your Edition you can type the following in the command line at the base of your project:
1212

1313
composer require pattern-lab/patternengine-twig
14-
14+
o
1515
See Packagist for [information on the latest release](https://packagist.org/packages/pattern-lab/patternengine-twig).
1616

1717
## Overview
@@ -76,12 +76,12 @@ Would be used like this in a pattern:
7676

7777
### Template inheritance
7878

79-
The requirements for using template inheritance with Pattern Lab:
79+
How to use [Template Inheritance](http://twig.sensiolabs.org/doc/templates.html#template-inheritance) with Pattern Lab:
8080

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' %}`.
8585

8686
An example of a simple layout called `base.twig` in `source/_layouts`:
8787

@@ -125,6 +125,8 @@ Would be used like this in a pattern:
125125
{% endblock %}
126126
```
127127

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+
128130
## Extending Twig Further
129131

130132
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

Comments
 (0)