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
{{ message }}
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.
Bastian Allgeier edited this page Aug 6, 2019
·
5 revisions
The editor stores its content as JSON. To convert it to HTML you can use the blocks field method in your templates.
<?=$page->text()->blocks() ?>
This will create the HTML defined in each block snippet.
Block collection
The blocks field method returns a Blocks collection, which can either be converted to HTML by simply echoing it (see above) or it can be used to inspect blocks individually and loop through them. The Blocks collection has the same methods as all other Kirby collections, like first, last, nth, sortBy, filterBy, limit, offset etc.
<?phpforeach ($page->text()->blocks() as$block): ?>
<!-- create some custom HTML for each block -->
<?phpendforeach?>