Предыдущая и следующая новость для DLE 9.7 и 9.8

Хак - след.предыдущая новость для DLE 9.7 - 9.8
В данном хаке добавляются 2 запроса.

Файл engine/modules/show.full.php
Найти
$disable_index = $row['disable_index'];

Добавить ВЫШЕ
$real_date = $row['date'];

Найти

} else
$tpl->set_block( "'\\[edit\\](.*?)\\[/edit\\]'si", "" );

Добавить ниже
// Ссылка вперед и назад
// Back Link
$backlink = $db->super_query( "SELECT * FROM " . PREFIX . "_post LEFT JOIN " . PREFIX . "_post_extras ON (" . PREFIX . "_post.id=" . PREFIX . "_post_extras.news_id) WHERE date <= '{$real_date}' AND id <> '{$row['id']}' AND category = '{$row['category']}' AND approve = '1' ORDER BY date DESC LIMIT 0,1" );
if( $backlink ) {


$backlink['date'] = strtotime( $backlink['date'] );
$backlink['category'] = intval( $backlink['category'] );


if( $config['allow_alt_url'] == "yes" ) {
if( $config['seo_type'] == 1 OR $config['seo_type'] == 2 ) {


if( $backlink['category'] AND $config['seo_type'] == 2 ) {


$c_url = get_url( $backlink['category'] );
$back_link = $config['http_home_url'] . $c_url . "/" . $backlink['id'] . "-" . $backlink['alt_name'] . ".html";


} else {


$back_link = $config['http_home_url'] . $backlink['id'] . "-" . $backlink['alt_name'] . ".html";


}


} else {


$back_link = $config['http_home_url'] . date( 'Y/m/d/', $backlink['date'] ) . $backlink['alt_name'] . ".html";


}
} else {


$back_link = $config['http_home_url'] . "index.php?newsid=" . $backlink['id'];


}
$tpl->set_block ( "'\\[back_link\\](.*?)\\[/back_link\\]'si", "\\1" );
$db->free();
} else {
$back_link = "";
$tpl->set_block ( "'\\[back_link\\].*?\\[/back_link\\]'si", "" );
}
// Next Link
$nextlink = $db->super_query( "SELECT * FROM " . PREFIX . "_post LEFT JOIN " . PREFIX . "_post_extras ON (" . PREFIX . "_post.id=" . PREFIX . "_post_extras.news_id) WHERE date >= '{$real_date}' AND id <> '{$row['id']}' AND category = '{$row['category']}' AND approve = '1' ORDER BY date ASC LIMIT 0,1" );
if ( $nextlink ) {
$nextlink['date'] = strtotime( $nextlink['date'] );
$nextlink['category'] = intval( $nextlink['category'] );


if( $config['allow_alt_url'] == "yes" ) {
if( $config['seo_type'] == 1 OR $config['seo_type'] == 2 ) {


if( $nextlink['category'] AND $config['seo_type'] == 2 ) {


$c_url = get_url( $nextlink['category'] );
$next_link = $config['http_home_url'] . $c_url . "/" . $nextlink['id'] . "-" . $nextlink['alt_name'] . ".html";


} else {


$next_link = $config['http_home_url'] . $nextlink['id'] . "-" . $nextlink['alt_name'] . ".html";


}


} else {


$next_link = $config['http_home_url'] . date( 'Y/m/d/', $nextlink['date'] ) . $nextlink['alt_name'] . ".html";


}
} else {


$next_link = $config['http_home_url'] . "index.php?newsid=" . $nextlink['id'];


}
$tpl->set_block ( "'\\[next_link\\](.*?)\\[/next_link\\]'si", "\\1" );
$db->free();
} else {
$next_link = "";
$tpl->set_block ( "'\\[next_link\\].*?\\[/next_link\\]'si", "" );
}
// Back and Next Link Template
$tpl->set( '{back-link}', $back_link );
$tpl->set( '{next-link}', $next_link );
// END хака

В шаблон fullstory.tpl добавляем в нужное место ссылки
[back_link]
<a href="{back-link}">Предыдущая новость</a>
[/back_link]
[next_link]
<a href="{next-link}">Следующая новость</a>
[/next_link]

Добавить комментарий

Нам важно знать ваше мнение. Оставьте свой отзыв или ответ

    • bowtiesmilelaughingblushsmileyrelaxedsmirk
      heart_eyeskissing_heartkissing_closed_eyesflushedrelievedsatisfiedgrin
      winkstuck_out_tongue_winking_eyestuck_out_tongue_closed_eyesgrinningkissingstuck_out_tonguesleeping
      worriedfrowninganguishedopen_mouthgrimacingconfusedhushed
      expressionlessunamusedsweat_smilesweatdisappointed_relievedwearypensive
      disappointedconfoundedfearfulcold_sweatperseverecrysob
      joyastonishedscreamtired_faceangryragetriumph
      sleepyyummasksunglassesdizzy_faceimpsmiling_imp
      neutral_faceno_mouthinnocent

Комментариев 0

Новые обсуждения на Форуме