*/
if(!defined('DATALIFEENGINE'))
{
die("Hacking attempt!");
}
/*===========================================
НАСТРОЙКИ
=============================================*/
$lastnewsconf['news'] = 200; // Длина новости
$lastnewsconf['link'] = 30; // Обрезание титла новостей
$lastnewsconf['limit'] = 10; // Количество новостей
$lastnewsconf['hide_html'] = true;// Уберать все теги из текста новости (true - да, false - нет)
$lastnewsconf['only_hide_main'] = false;// Показывать только новости не опубликованые на главной (true - да, false - нет)
$lastnewsconf['category'] = '1,2,3,4,5'; // Показывать категории, перечислите ID категорий через запятую без пробелов. Если нужно показвать все оставте поле пустым
$lastnews = dle_cache("lastnews", $config['skin']);
if (!$lastnews) {
//include(ENGINE_DIR.'/inc/parse.class.php');
//$parse = new ParseFilter(Array(), Array());
if ($lastnewsconf['only_hide_main'])
$ln_allow_main = 'and allow_main=0';
else
$ln_allow_main = '';
if ($lastnewsconf['category'])
$ln_category = 'and category = '. str_replace(',',' or ', $lastnewsconf['category']);
else
$ln_category = '';
$tpl->load_template('lastnews.tpl');
$db->query("SELECT id, title, short_story , date, alt_name FROM ". PREFIX . "_post WHERE approve='1' $ln_allow_main $ln_category ORDER BY date DESC LIMIT 0,{$lastnewsconf['limit']}");
while($row = $db->get_row()){
$row['date'] = strtotime($row['date']);
if (strlen($row['title']) > $lastnewsconf['link'])
$title = substr ($row['title'], 0, $lastnewsconf['link'])." ..";
else
$title = $row['title'];
//$row['short_story'] = preg_replace("/\[attachment=[[:digit:]]*\]/si","",stripslashes($parse->BB_Parse($parse->process($row['short_story']))));
$row['short_story'] = preg_replace("/\[attachment=[[:digit:]]*\]/si","",stripslashes($row['short_story']));
$row['short_story'] = preg_replace("/<!--*-->/si","",$row['short_story']);
if($lastnewsconf['hide_html'])$row['short_story'] = strip_tags($row['short_story']);
if (strlen($row['short_story']) > $lastnewsconf['news'])
$short_story = substr ($row['short_story'], 0, $lastnewsconf['news'])." ...";
else
$short_story = $row['short_story'];
$go_page = ($config['ajax']) ? "onclick=\"DlePage('newsid=".$row['id']."'); return false;\" " : "";
if ($config['allow_alt_url'] == "yes")
$tpl->set_block("'\[full-link\](.*?)\[/full-link\]'si", "<a {$go_page}href=\"".$config['http_home_url'].date('Y/m/d/', $row['date']).$row['alt_name'].".html\">\\1</a>");
else
$tpl->set_block("'\[full-link\](.*?)\[/full-link\]'si", "<a {$go_page}href=\"$PHP_SELF?newsid=".$row['id']."\">\\1</a>");
$tpl->set('{title}', stripslashes($title));
$tpl->set('{short_news}', $short_story);
$tpl->compile('lastnews');
}
$lastnews = $tpl->result['lastnews'];
}
?>