Pigini
Знаток
- Регистрация
- 28 Апр 2009
- Сообщения
- 173
- Реакции
- 29
- Автор темы
- #1
Модуль - «Последние Комментарии»
Выводит последние комментарии, НО как сделать что бы новости не повторялись?
Вот пример -
Как сделать что бы не повторялись новости?
вот сам скрипт модуля.
Выводит последние комментарии, НО как сделать что бы новости не повторялись?
Вот пример -

Как сделать что бы не повторялись новости?
вот сам скрипт модуля.
PHP:
<?php
if( ! defined( 'DATALIFEENGINE' ) ) {
die( "Hacking Attempt!" );
}
$commentslast = dle_cache( "comments-last", $config['skin'] );
if( ! $commentslast ) {
include( ROOT_DIR . "/engine/data/comments-last.php" );
if( $commentslast['on'] == "1" ) {
define( "LIMITCOMM", $commentslast['lines'] );
define( "LIMITTITL", $commentslast['titlelimit'] );
define( "SHOWHITHB", $commentslast['showhint'] );
$sql = $db->query( "SELECT comments.post_id, comments.is_register, comments.text, comments.autor, comments.email, post.id, post.date as newsdate, post.title, post.category, post.alt_name, post.flag FROM " . PREFIX . "_comments as comments, " . PREFIX . "_post as post WHERE post.id=comments.post_id ORDER BY comments.date DESC LIMIT 0, " . LIMITCOMM );
while( $row = $db->get_row($sql) ) {
$row['date'] = strtotime($row['date']);
$row['newsdate'] = strtotime($row['newsdate']);
$row['date'] = strtotime($row['date']);
if( strlen( $row['title']) > LIMITTITL )
$title = substr( $row['title'], 0, LIMITTITL ) . "...";
else
$title = $row['title'];
if( strlen( $row['text'] ) > 300 )
$text = htmlspecialchars( stripslashes( substr ($row['text'], 0, 300) . "..." ) );
if(! $row['is_register'] == "1" ) {
if( $row['email'] != "") {
if( preg_match( "/^[\.A-z0-9_\-]+[@][A-z0-9_\-]+([.][A-z0-9_\-]+)+[A-z]{1,4}$/", $row['email'] ) ) { $url_target = ""; $mail_or_url = "mailto:"; }
else {
$url_target = "target=\"_blank\"";
$mail_or_url = "";
if( substr( $row[email], 0, 3 ) == "www" ) { $mail_or_url = "http://"; } }
if( $mail_or_url == "mailto:" ) {
$email = explode("@", $row['email'], 2);
$autor = "<script>var em0 = '$email[0]'; document.write('<a href=\"mailto:' + em0 + '@$email[1]\">" . $row['autor'] . "</a>');</script>";
} else {
$autor = "<a $url_target href=\"$mail_or_url" . $row[email] . "\">" . $row['autor'] . "</a>"; }
} else { $autor = $row['autor']; }
} else {
if( $config['allow_alt_url'] == "yes" ) {
$autor = "<a href=\"" . $config['http_home_url'] . "user/" . urlencode( $row['autor'] ) . "/\">" . $row['autor'] . "</a>";
} else {
$autor = "<a href=\"$PHP_SELF?subaction=userinfo&user=" . urlencode( $row['autor'] ) . "\">" . $row['autor'] . "</a>"; } }
$row['date'] = strtotime( $row['date'] );
$row['category'] = intval( $row['category'] );
if( $config['allow_alt_url'] == "yes" ) {
if( $row['flag'] ) {
$full_link = $config['http_home_url'] . $row['id'] . "-" . $row['alt_name'] . ".html";
} else {
$full_link = $config['http_home_url'] . $row['id'] . $row['alt_name'] . ".html";
}
} else {
$full_link = $config['http_home_url'] . "index.php?newsid=" . $row['id'];
}
$post = "<a href=\"" . $full_link . "#comment\">" . stripslashes( $title ) . "</a>";
$maimt = '<b>' . $row['autor'] . ' Написал:</b><br /><br />';
$text = htmlspecialchars( stripslashes( $row['text'] ) );
$copy = '<hr /><div align=right>' . $commentslast['copyright'] . '</div>';
$width = $commentslast['width'] . 'px';
if( SHOWHITHB == "yes" ) {
$box = "onmouseover=\"showhint('{$maimt} {$text} {$copy}', this, event, '{$width}')\"";
}
$lcomm .= "<div {$box}><div onmouseover=\"this.className='lastcomm_over';\" onmouseout=\"this.className='lastcomm';\" class=\"lastcomm\">написал: {$autor}<br />в новости: {$post}</div></div><div style=\"display:none\"><a href=\"http://wfound.ru/\">варез</a><a href=\"http://zloy-soft.ru/\">скачать бесплатно</a><a href=\"http://zloy.net.ua/\">скачать варез</a><a href=\"http://wfound.ru/\">варез портал всё бесплатно</a></div> "; }
$commentslast= "<script type=\"text/javascript\" src=\"" . $config['http_home_url'] . "engine/skins/default.js\"></script>" . $lcomm . "";
$db->free();
create_cache( "comments-last", $commentslast, $config['skin'] );
} else {
$commentslast= "Модуль отключен в Панели Управления...";
}
}
?>