Eno\Section » elements

elements() → array

Retrieve the elements of this section in sequential order. This seamlessly lets you switch from associative readout to sequential readout, allowing sections within, or the whole document, to represent document-like structures (think generic markup) instead of just associative data stores.

enodate: 2018-03-01
title: My blog post

# page

h1: Hello world
p: This is my first post, I'm so happy!
php$document = Parser::parse($input);

metadata = [
  'date' => $document->field('date', $my_date_loader_function),
  'title' => $document->field('title')
];

$html = '';

foreach($document->section('page')->elements() as $element) {
  $html .= "<{$element->name}>{$element->value()}</{$element->name}>";
}

file_put_contents('index.html', $html);

Return value

An array containing the elements of this section.