Function __global->cns_get_topic_tree

Definitions

sources/cns_forums2.php

  • Get a list of maps containing all the topics, and path information, under the specified forum - and those beneath it, recursively.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: array

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$forum_id ?AUTO_LINK No No Null N/A N/A The forum being at the root of our recursion (null: true root forum)
$breadcrumbs ?string No No Null N/A N/A The breadcrumbs up to this point in the recursion (null: blank, as we are starting the recursion)
$title ?ID_TEXT No No Null N/A N/A The forum name of the $forum_id we are currently going through (null: look it up). This is here for efficiency reasons, as finding children IDs to recurse to also reveals the child's title
$levels ?integer No No Null N/A N/A The number of recursive levels to search (null: all)

Returns

  • A list of maps for all forums. Each map entry containing the fields 'id' (forum ID) and 'breadcrumbs' (path to the forum, including the forums own title), and more.
  • Type: array
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Get a list of maps containing all the topics, and path information, under the specified forum - and those beneath it, recursively.
 *
 * @param  ?AUTO_LINK $forum_id The forum being at the root of our recursion (null: true root forum)
 * @param  ?string $breadcrumbs The breadcrumbs up to this point in the recursion (null: blank, as we are starting the recursion)
 * @param  ?ID_TEXT $title The forum name of the $forum_id we are currently going through (null: look it up). This is here for efficiency reasons, as finding children IDs to recurse to also reveals the child's title
 * @param  ?integer $levels The number of recursive levels to search (null: all)
 * @return array A list of maps for all forums. Each map entry containing the fields 'id' (forum ID) and 'breadcrumbs' (path to the forum, including the forums own title), and more.
 */

function cns_get_topic_tree(?int $forum_id = null, ?string $breadcrumbs = null, ?string $title = null, ?int $levels = null) : array