Skip to content

Commit 6a5ce31

Browse files
authored
Merge pull request #58 from jaywilliams/patch-2
Document improved sub-template workflow
2 parents c9ec5e4 + ae8b322 commit 6a5ce31

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,11 @@ $phpView->render($response, $template, [
7878
```
7979

8080
## Sub-templates
81-
Inside your templates you may use `$this` to refer to the PhpRenderer object to render sub-templates.
81+
Inside your templates you may use `$this` to refer to the PhpRenderer object to render sub-templates. If using a layout the `fetch()` method can be used instead of `render()` to avoid appling the layout to the sub-template.
82+
83+
```phtml
84+
<?=$this->fetch('./path/to/partial.phtml', ["name" => "John"])?>
85+
```
8286

8387
## Rendering in Layouts
8488
You can now render view in another views called layouts, this allows you to compose modular view templates

0 commit comments

Comments
 (0)