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;
}
Returns the Node's keyword (the file name minus the .md
extension).
Returns the Markdown parsed body of the Node.
Returns an array of tags that were specified in the Node's header.
Returns true/false
whether the Node has the specified $tag
.
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
Returns any value specified in the Node's header.