<?php
/*
=====================================================
Файл: sitemap.php
-----------------------------------------------------
Назначение: Кликабельная карта сайта.
=====================================================
*/
$map .= "<style type=text/css>
.first_level{
margin:0px 0px 0px 10px;
font-size: 13px;
font-weight: bold;
color: #cccccc;
display: block;
}
.second_level{
margin:0px 0px 0px 20px;
font-size: 11px;
color: #333333;
display:block;
}
</style>";
   $cat = -1;
   $result=$db->query("SELECT `post`.alt_name post_alt_name,`category`.alt_name cat_alt_name,`post`.date,`post`.title,
        `post`.category,`post`.title,`category`.name,`post`.id,`post`.news_read,`post`.comm_num, `post`.autor
        FROM `".PREFIX."_post` AS `post`, `".PREFIX."_category` AS `category`
        WHERE `post`.category = `category`.id
        ORDER BY `category`.id,`post`.date DESC");
    while($row = $db->get_row($result))
    {
      if ($row['category']!=$cat)
      {
        $map .= "<span class='first_level'><a href='".$config['http_home_url']."category/".$row['cat_alt_name']."'>".$row[name]."</a></span>\n";
        $cat = $row['category'];
      }
      if ($config['allow_alt_url'] == "yes")
      $map .= "<span class='second_level'><a href=".$config['http_home_url'].str_replace("-","/",substr($row['date'],0,10))."/".$row['post_alt_name'].".html>".stripslashes($row[title])."</a></span>\n";
      else
      $map .= "<span class='second_level'><a href=".$config['http_home_url']."index.php?newsid=".$row['id'].">".stripslashes($row[title])."</a> </span>\n";
    }
    $tpl->load_template('static.tpl');
    $tpl->set('{description}', "Карта материалов сайта");
    $tpl->set('{static}', $map);
    $tpl->compile('content');
    $tpl->clear();
?>