exist(NEWS_TABLE, "news_ID", $nid)) { $temp = mysql_fetch_assoc(mysql_query("SELECT * FROM ".NEWS_TABLE." ORDER BY news_ID DESC LIMIT 1")); $nid = $temp['news_ID']; } $r = @mysql_fetch_assoc(mysql_query("SELECT * FROM ".NEWS_TABLE." WHERE news_ID=$nid")); $page_title = $r[$field[title]]; require("_header.php"); echo '

'.$r[$field[title]].'

'.str_replace("../", "", $r[$field[full]]).' '; require("_footer.php"); exit(); } else { $page_title = "КСД ООД - Новини"; // $page_title = $LANG['news-title']; require("_header.php"); $news_sql = "SELECT * FROM ".NEWS_TABLE." ORDER BY sort+0, sort, date DESC"; $news_q = mysql_query($news_sql); if (mysql_num_rows(mysql_query($news_sql)) != 0) { while ($news_row = mysql_fetch_assoc($news_q)) { echo '

'.$news_row[$field[title]].' ('.timestamp($news_row["date"], "simple").')

'; echo cuttext(strip_tags(str_replace("../", "", $news_row[$field[full]])), 250).'
'; } } require("_footer.php"); exit(); } function cuttext($text, $len=150) { if (mb_strlen($text) > $len) { $space = mb_strpos($text, " ", $len)-1; if ($space > 0) { $text = mb_substr($text, 0, ($space+1)); } } return $text; } ?>