AddTag("NEWS_TITLE", $lang['news']); $main_result=sql_query("SELECT id, title, author, date, text FROM ".$SQL_PREFIX."_news WHERE published = 'yes' ORDER BY date DESC LIMIT 5"); $total_result=sql_num_rows($main_result); $template -> AddRow("news"); for($i=0;($i<(5)) && ($i<$total_result);$i++) { $news = sql_fetch_object($main_result); $news->text=strip_tags($news->text); $text = substr($news->text, 0, 100); $date = $news->date; $time = $news->date; DateFormat($date); TimeFormat($time); if(date(Y.'-'.m.'-'.d) == substr($news->date, 0, 10)) { $template -> AddTag("NEWS_DATE", ''.$lang[today].'', "news"); } else { $template -> AddTag("NEWS_DATE", $date . ' ' . $time, "news"); } /* SEO URL */ if($cfg['url_rewrite'] == 1) { $template -> AddTag("NEWS_LINK", 'news#'.$news->id, "news"); } else { $template -> AddTag("NEWS_LINK", 'news.php#'.$news->id, "news"); } $template -> AddTag("NEWS_TITLE", $news->title, "news"); $template -> AddTag("NEWS_TEXT", $text, "news"); $template -> ParseRow("news"); } $template -> AddTag("ARTICLES_TITLE", $lang['articles']); $main_result=sql_query("SELECT article, title, type, authors, date_pub, date_update, annotation, img, part, column_, item, redir FROM ".$SQL_PREFIX."_articles WHERE part = '1' AND published = 'yes' ORDER BY date_update DESC "); $total_result=sql_num_rows($main_result); $template -> AddRow("articles"); for($i=0;($i<(5)) && ($i<$total_result);$i++) { $articles = sql_fetch_object($main_result); $result=sql_query("SELECT title, address FROM ".$SQL_PREFIX."_articles_column WHERE id = '" . $articles->column_ . "';"); $column = sql_fetch_object($result); /* Authors */ $articles->author = explode(';', $articles->authors); for($j=0;$j<(count($articles->author)-1);$j++) { $result = sql_query("SELECT name, item FROM ".$SQL_PREFIX."_authors WHERE id = '" . $articles->author[$j] . "';"); $author = sql_fetch_object($result); if($j != (count($articles->author)-2)) { if($cfg['url_rewrite'] == 1) { $article_authors .= ''. $author->name .', '; } else { $article_authors .= ''. $author->name .', '; } } else { if($cfg['url_rewrite'] == 1) { $article_authors .= ''. $author->name .''; } else { $article_authors .= ''. $author->name .''; } } } $result=sql_query("SELECT id FROM ".$SQL_PREFIX."_comments_articles WHERE idw = '" . $articles->article . "';"); $post['count'] = sql_num_rows($result); $result=sql_query("SELECT type FROM ".$SQL_PREFIX."_articles_types WHERE id = '" . $articles->type . "';"); $row_array = sql_fetch_row($result); $type = $row_array[0]; include('lib/comments.php'); $date = $articles->date_pub; $date_pub = DateFormat($date); $date = $articles->date_update; $date_update = DateFormat($date); /* Normal articles */ if(empty($articles->redir)) { if(!empty($articles->img)) { $template -> AddTag("ARTICLE_IMG_P1", '
|
| ', "articles"); } /* SEO URL */ if($cfg['url_rewrite'] == 1) { $template -> AddTag("ARTICLE_URL", $cfg['server_url'] .'article/'. $column->address .'/'. $articles->item, "articles"); } else { $template -> AddTag("ARTICLE_URL", $cfg['server_url'] .'article.php?item='. $articles->item, "articles"); } $template -> AddTag("ARTICLE_TITLE", $articles->title, "articles"); $template -> AddTag("ARTICLE_DATE_PUB", $date_pub, "articles"); if($articles->date_pub != $articles->date_update) { $template -> AddTag("ARTICLE_DATE_UPDATE", ' '. $lang[updated] .': '. $date_update .'', "articles"); } $template -> AddTag("ARTICLE_AUTHORS", ', '. $article_authors, "articles"); $template -> AddTag("ARTICLE_TYPE", ', '.$type, "articles"); $template -> AddTag("ARTICLE_COMMENTS", ', '. $post['count'] . ' ' . $post['name'] .'', "articles"); $template -> AddTag("ARTICLE_ANNOTATION", $articles->annotation, "articles"); if(!empty($articles->img)) { $template -> AddTag("ARTICLE_IMG_P2", ' |
| ');
echo(' | ');
}
echo(''. $articles->title . ''); echo(''. $date . ', '.$type.' ');
echo(''. $articles->annotation .' ');
if(!empty($articles->img)) {echo(' |