fast framework Help

Iterating

purpose

Iterate over a collection of ffNodes (by default the child nodes of the current node).

usage

Add data-ffIterate attribute to any DOM node in the template.

<div data-ffIterate> <div> <div data-ffText="name"></div> <div data-ffMedia></div> </div> </div>

This will output the names and media of each of the current node's child nodes, by scoping every iteration to the respective child node.

If you need more control about what is being iterated over, you can specify a callback method to retrieve a custom collection of ffNodes from the presenter class.

template

<div data-ffIterate='{"from":"getCollection"}'> <div> <div data-ffText="name"></div> <div data-ffMedia></div> </div> </div>

presenter class

[...] public function getCollection(){ return $this->me->getOffspring(); } [...]

This will iterate over all offspring nodes of the current node.

This functionality is WIP. The following limitations currently apply:

options

{ "scope" : null, // the node to be iterated over, written in trace-path notation (ignored, if "from"-option is given) "from" : null // a public method of the presenter object that returns an iterable of nodes to iterate over. }
22 Februar 2024