Nodes in IPS4 are a structural concept used to organize content items. They resemble a tree, with parent nodes containing child nodes, which may contain other child nodes or content items, and so on.
In IPS4, nodes serve a range of uses where a parent/child relationships are required, but the most common use is as a category hierarchy where nodes represent categories and containers for content items. This is the use that we'll focus on in this documentation.
Generally speaking, nodes are admin-created entities. The interfaces for managing them exist in the AdminCP.
Note: Nodes do have the ability to have sub-nodes of a different class to themselves. Because this is complicated and not usually needed for content items, methods and properties pertaining to it have been omitted in this documentation.
Example
The most obvious example of a node structure is that of categories, forums and topics in the Forums app. In code, categories and forums are actually the same thing - they are nodes represented by the Forum model (the term 'category' is simply used as a way to clarify functionality for users). Therefore, a parent forum can have child forums, and those child forums can themselves have child forums, or contain topics which are the content items. The node models in IPS4 handle the forum structure, while the content models handle the content items (the content models are discussed in a separate section of this developer documentation).
| Parent Forum (Forum node model) |-- Child Forum (Forum node model) |---- Topics (Topic content item model) |--- Child Forum (Forum node model) |--- etc.
Composition
IPS4 provides a number of classes that assist with implementing node functionality. Each part will be discussed in more depth in later sections, but they include:
-
Model - \IPS\Node\Model
Provides data access and manipulation methods for nodes by extending \IPS\Patterns\ActiveRecord -
Controller - \IPS\Node\Controller
Extends the standard dispatch controller to add automatic support for interfaces to manage node items in the AdminCP. -
Helpers
The most relevant helper for nodes is \IPS\Helpers\Tree which builds an interactive tree interface (although this helper isn't only limited to working with nodes).
Report Document