/**
  * Создает новый дочерний блок и возвращает указатель не его объект.
  * @param string $name
  * @param bool   $enabled
  * @param bool   $poly
  * @param string $alias
  * @param string $templatefile
  * @param string $plaintext
  * @return StarkytBlock
  */
 public function NewBlock($name, $enabled = true, $poly = false, $alias = '', $templatefile = '', $plaintext = '')
 {
     $this->block['child'][$name] = Starkyt::CreateBlock($enabled, $poly, $alias, $templatefile, $plaintext, array(), $this);
     if ($templatefile != '') {
         $this->starkyt->GetSBlocks($templatefile);
     }
     return new StarkytBlock($this->block['child'][$name], $this->starkyt, $name);
 }
    $childs['block_menu_items'] = $block_menu_items;
    return;
}
// Выборка
$pages = System::database()->Select('pages', GetWhereByAccess('view', "`enabled`='1' and `showinmenu`='1'"), null, 'order');
$catsPid = array();
foreach ($pages as $page) {
    $catsPid[$page['parent']][] = $page;
}
if (!isset($catsPid[0])) {
    $catsPid[0] = array();
}
// Генерация меню
$items = Starkyt::CreateBlock(true, true, 'menu_item');
foreach ($catsPid[0] as $page) {
    $subitems = Starkyt::CreateBlock(true, true, 'menu_subitem');
    $link = '';
    if ($page['type'] == 'page') {
        $link = Ufu('index.php?name=pages&file=' . SafeDB($page['link'], 255, str), 'pages:page');
    } elseif ($page['type'] == 'link') {
        $link = SafeDB($page['text'], 255, str);
        if (substr($link, 0, 6) == 'mod://') {
            $link = Ufu('index.php?name=' . substr($link, 6), 'system:mod');
        }
    }
    $link = str_replace('&', '&', $link);
    $item_vars = array('title' => $page['title'], 'link' => $link, 'selected' => false, 'subitems' => false);
    if (isset($catsPid[$page['id']])) {
        foreach ($catsPid[$page['id']] as $subpage) {
            if ($subpage['type'] == 'page') {
                $link = Ufu('index.php?name=pages&file=' . SafeDB($subpage['link'], 255, str), 'pages:page');