define(array('mainidx' => 'all_index.tpl')); $tpl->assign ('PAGE_TITLE', 'Новости'); $tpl->assign ('KEY_WORDS', 'Новости развитие хронология обзоры'); $tpl->define_dynamic('row', 'mainidx'); $tpl->parse ('ft_head', 'head'); $tpl->FastPrint ('ft_head'); $res_razdel = mysqli_query ("SELECT value,title FROM a_news_razdel ORDER BY id"); // DISTINCT - пришлось убрать после перехода на UTF $in_page = $cfg ['links_latest']; while ($rr = mysqli_fetch_array ($res_razdel)) { if ( ($rr['value']=='drafts') && empty ($_GET ['includedrafts'])) { continue; } $tpl->assign( array( "NAME_RAZDEL" => $rr['title'], "ARCHIVE_LINK" => 'archive/' . $rr['value'] . '/' ) ); $sql = "SELECT *,date_format(date, '%d/%m/%Y') as ddate FROM a_news_db WHERE razdel='$rr[value]' ORDER BY id DESC LIMIT $in_page"; $result = mysqli_query ($sql); if (@mysqli_num_rows ($result) > 0) { while ($r = mysqli_fetch_array ($result)) { if ($r['urgent']) { $dt = '' . $r['ddate'] . ''; $comment = '(важная)'; }else{ $dt = '' . $r['ddate'] . ''; $comment = ''; }; $tpl->assign( array( "N_INFO" => $dt, "N_LINK" => $r ['id'] . '/', "N_TITLE" => stripslashes ($r ['title']), "N_COMMENT" => $comment ) ); $tpl->parse ('ft_mainidx', '.row'); } $tpl->parse ('ft_mainidx', 'mainidx'); $tpl->FastPrint ('ft_mainidx'); } $tpl->clear ('ft_mainidx'); } $tpl->parse ('ft_foot', 'foot'); $tpl->FastPrint ('ft_foot'); ?>