PAGENODE

About Documentation Github

Nodes API Reference

Node instances are constructed and returned by the various selectors. See Adding Content for some examples.

All values are escaped by htmlSpecialChars() and are safe for output in a template.

E.g. to get a bunch of Node instances:

$nodes = select('nodes/')->newest(5);
foreach ($nodes as $n) {
    echo $n->body;
}

$node->keyword

Returns the Node's keyword (the file name minus the .md extension).

$node->body

Returns the Markdown parsed body of the Node.

$node->tags

Returns an array of tags that were specified in the Node's header.

$node->hasTag($tag)

Returns true/false whether the Node has the specified $tag.

$node->date

Returns a PN_DateTime object. PN_DateTime has a single format($s) method to format the datetime, analogous to PHPs date function. It also stringifies to the configurable PN_DATE_FORMAT.

E.g.:

echo $node->date->format('y.m.d');
echo $node->date; // Uses PN_DATE_FORMAT

$node->anythingElse

Returns any value specified in the Node's header.

© 2019 Dominic Szablewski – rendered in (0.86ms)