Хак Хак для DLE "Последний коммент"
Хак для DataLife Engine "Последний коммент"
Хак повзолит пользователям при нажатии на "комментарии" переходить сразу на последнюю страницу с комментариями к новости, а не на первую как это сделано стандартно.
1) Открываем файл show.full.php
Найдите:
i
f( $allow_comments AND $news_found) {
Добавьте ВЫШЕ:
if ($_REQUEST['lastcom'])
{
$last_page = @ceil($comments_num / $config['comm_nummers']);
if ($last_page)
{
if ($config['allow_alt_url'] == "yes")
$last_page = $link_page . $last_page ."," . $news_name . ".html#comment";
else
$last_page = $PHP_SELF."?cstart=" . $last_page . "&".$link."#comment";
header("Location: $last_page");
}
}
2) Откройте show.short.php
Найдите:
if( $config['allow_alt_url'] == "yes" ) {
if( $row['flag'] and $config['seo_type'] ) {
if( $row['category'] and $config['seo_type'] == 2 ) {
$full_link = $config['http_home_url'] . get_url( $row['category'] ) . "/" . $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'] . date( 'Y/m/d/', $row['date'] ) . $row['alt_name'] . ".html";
}
} else {
$full_link = $config['http_home_url'] . "index.php?newsid=" . $row['id'];
}
Замените на:
if( $config['allow_alt_url'] == "yes" ) {
if( $row['flag'] and $config['seo_type'] ) {
if( $row['category'] and $config['seo_type'] == 2 ) {
$full_link = $config['http_home_url'] . get_url( $row['category'] ) . "/" . $row['id'] . "-" . $row['alt_name'] . ".html";
$full_link_com = $config['http_home_url'] . get_url( $row['category'] ) . "/lastcom/" . $row['id'] . "-" . $row['alt_name'] . ".html";
} else {
$full_link = $config['http_home_url'] . $row['id'] . "-" . $row['alt_name'] . ".html";
$full_link_com = $config['http_home_url'] ."lastcom/". $row['id'] . "-" . $row['alt_name'] . ".html";
}
} else {
$full_link = $config['http_home_url'] . date( 'Y/m/d/', $row['date'] ) . $row['alt_name'] . ".html";
$full_link_com = $config['http_home_url'] . date( 'Y/m/d/', $row['date'] ) ."lastcom/". $row['alt_name'] . ".html";
}
} else {
$full_link = $config['http_home_url'] . "index.php?newsid=" . $row['id'];
$full_link_com = $config['http_home_url'] . "index.php?newsid=" . $row['id'] . "&lastcom=1";
}
Найдите:
$tpl->set( '[com-link]', "<a {$go_page}href="" . $full_link . "#comment">" );
Замените на:
$tpl->set( '[com-link]', "<a {$go_page}href="" . $full_link_com . "">" );