{{$database = \IPS\cms\Databases::load($database->id);}} {{$catClass = '\IPS\cms\Categories' . $database->id;}} {{$recordClass = '\IPS\cms\Records' . $database->id;}} {{$records=null;}} {{if settings.SuperDocs_recordslevel > 0}} {{$records = $recordClass::getItemsWithPermission( array(),$database->field_sort . ' ' . $database->field_direction, 10000 );}} {{endif}} {{$firstRecord = null;}} {{$currentUrlPath = \IPS\Request::i()->url()->data['path'];}} {{$SuperDocs_levels=\IPS\Settings::i()->SuperDocs_recordslevel;}}
{{if $catClass and count($catClass::roots())}}
    {{foreach $catClass::roots() as $root}}
  • {$root->_title}

    {{if count($root->children())}}
      {{foreach $root->children() as $child}}
    • {$child->_title}

      {{if count($child->children())}}
        {{foreach $child->children() as $subchild}}
      • {$subchild->_title}
        {{if count($subchild->children())}}
          {{foreach $subchild->children() as $subsubchild}}
        • {$subsubchild->_title}
          {{if $records AND $SuperDocs_levels > 3}} {{foreach $records as $childrecord}} {{if $childrecord->container()->_id == $subsubchild->_id}} {{endif}} {{endforeach}} {{endif}}
        • {{endforeach}}
        {{endif}} {{if $records AND $SuperDocs_levels > 2}} {{foreach $records as $childrecord}} {{if $childrecord->container()->_id == $subchild->_id}} {{endif}} {{endforeach}} {{endif}}
      • {{endforeach}}
      {{endif}} {{if $records AND $SuperDocs_levels > 1}} {{foreach $records as $subchildrecord}} {{if $subchildrecord->container()->_id == $child->_id}} {{endif}} {{endforeach}} {{endif}}
    • {{endforeach}}
    {{endif}}
      {{if $records AND $SuperDocs_levels > 0}} {{foreach $records as $navrecord}} {{if $navrecord->container()->_id == $root->_id}} {{if $firstRecord == null}} {{$firstRecord = $navrecord;}} {{endif}}
    • {$navrecord->_title}
    • {{endif}} {{endforeach}} {{endif}}
  • {{endforeach}}
{{endif}}