mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-07-01 08:59:42 +02:00
Merge pull request #9579 from scttw/patch-1
DOC Update 04_Rendering_Templates.md
This commit is contained in:
commit
47855e3e49
|
@ -34,6 +34,19 @@ echo $arrayData->renderWith('Coach_Message');
|
||||||
|
|
||||||
// returns "<strong>John</strong> is the Head Coach on our team."
|
// returns "<strong>John</strong> is the Head Coach on our team."
|
||||||
|
|
||||||
|
```
|
||||||
|
If your template is a Layout template that needs to be rendered into the main Page template (to include a header and footer, for example), you need to render your Layout template into a string, and pass that as the Layout parameter to the Page template.
|
||||||
|
|
||||||
|
```php
|
||||||
|
$data = [
|
||||||
|
'Title' => 'Message from the Head Coach'
|
||||||
|
];
|
||||||
|
|
||||||
|
return $this->customise([
|
||||||
|
'Layout' => $this
|
||||||
|
->customise($data)
|
||||||
|
->renderWith(['Template\Path\From\templates\Layout\Coach_Message'])
|
||||||
|
])->renderWith(['Page']);
|
||||||
```
|
```
|
||||||
|
|
||||||
[info]
|
[info]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user