Изменяем внутреннюю навигацию в новости

Изменяем внутреннюю навигацию в новости

По умолчанию в DLE установлен следующий вид навигации:
Страница 1 из 2 | Следующая страница

С помощью этого хака можно заменить внутреннюю навигацию в новостях на такой cтиль:
< 1 2 >
< 3 4 5 >
< 6 7 >
 
Установка:
1. Открыть engine/modules/show.full.php и найти:
            if( $anzahl_seiten > 1 ) {
                
                if( $news_page < $anzahl_seiten ) {
                    $pages = $news_page + 1;
                    
                    if( $config['allow_alt_url'] == "yes" ) {
                        $nextpage = " | <a href=\"" . $short_link . "page," . $pages . "," . $row['alt_name'] . ".html\">" . $lang['news_next'] . "</a>";
                    } else {
                        $nextpage = " | <a href=\"$PHP_SELF?newsid=" . $row['id'] . "&amp;news_page=" . $pages . "\">" . $lang['news_next'] . "</a>";
                    }
                }
                
                if( $news_page > 1 ) {
                    $pages = $news_page - 1;
                    
                    if( $config['allow_alt_url'] == "yes" ) {
                        $prevpage = "<a href=\"" . $short_link . "page," . $pages . "," . $row['alt_name'] . ".html\">" . $lang['news_prev'] . "</a> | ";
                    } else {
                        $prevpage = "<a href=\"$PHP_SELF?newsid=" . $row['id'] . "&amp;news_page=" . $pages . "\">" . $lang['news_prev'] . "</a> | ";
                    }
                }
                
                $tpl->set( '{pages}', $prevpage . $lang['news_site'] . " " . $news_page . $lang['news_iz'] . $anzahl_seiten . $nextpage );
                
                if( $config['allow_alt_url'] == "yes" ) {
                    
                    $replacepage = "<a href=\"" . $short_link . "page," . "\\1" . "," . $row['alt_name'] . ".html\">\\2</a>";
                
                } else {
                    
                    $replacepage = "<a href=\"$PHP_SELF?newsid=" . $row['id'] . "&amp;news_page=\\1\">\\2</a>";
                }
                
                $row['full_story'] = preg_replace( "'\[PAGE=(.*?)\](.*?)\[/PAGE\]'si", $replacepage, $row['full_story'] );
            
            } else {
                
                $tpl->set( '{pages}', '' );
                $row['full_story'] = preg_replace( "'\[PAGE=(.*?)\](.*?)\[/PAGE\]'si", "", $row['full_story'] );
            }

Заменить на:
            if( $anzahl_seiten > 1 ) {
                
                if( $news_page < $anzahl_seiten ) {
                    $pages = $news_page + 1;
                    
                    if( $config['allow_alt_url'] == "yes" ) {
                        $nextpage = " <a href=\"" . $short_link . "page," . $pages . "," . $row['alt_name'] . ".html\">" . $pages . "</a>";
                    } else {
                        $nextpage = " <a href=\"$PHP_SELF?newsid=" . $row['id'] . "&amp;news_page=" . $pages . "\">" . $pages . "</a>";
                    }

                }

                if( $news_page < $anzahl_seiten-1 ) {
                    $pages = $news_page + 1;
                    
                     if( $config['allow_alt_url'] == "yes" ) {
                        $nextpage .= " <a class=\"arr_nav\" href=\"" . $short_link . "page," . ($pages+1) . "," . $row['alt_name'] . ".html\">></a>";
                    } else {
                        $nextpage .= " <a class=\"arr_nav\" href=\"$PHP_SELF?newsid=" . $row['id'] . "&amp;news_page=" . ($pages+1) . "\">></a>";
                    }
                } else {
                    $nextpage .=" <span class=\"arr_nav\">></span>";
                }
                
                if( $news_page > 2 ) {
                    $pages = $news_page - 1;
                    
                    if( $config['allow_alt_url'] == "yes" ) {
                        $prevpage = "<a class=\"arr_nav\" href=\"" . $short_link . "page," . ($pages-1) . "," . $row['alt_name'] . ".html\"><</a> ";
                    } else {
                        $prevpage = "<a class=\"arr_nav\" href=\"$PHP_SELF?newsid=" . $row['id'] . "&amp;news_page=" . ($pages-1) . "\"><</a> ";
                    }
                } else {
                    $prevpage = "<span class=\"arr_nav\"><</span> ";
                }

                if( $news_page > 1 ) {
                    $pages = $news_page - 1;
                    
                    if( $config['allow_alt_url'] == "yes" ) {
                        $prevpage .= "<a href=\"" . $short_link . "page," . $pages . "," . $row['alt_name'] . ".html\">" . $pages . "</a> ";
                    } else {
                        $prevpage .= "<a href=\"$PHP_SELF?newsid=" . $row['id'] . "&amp;news_page=" . $pages . "\">" . $pages . "</a> ";
                    }
                }

                $tpl->set( '{pages}', $prevpage . "<span>" . $news_page . "</span>" . $nextpage );
                
                if( $config['allow_alt_url'] == "yes" ) {
                    
                    $replacepage = "<a href=\"" . $short_link . "page," . "\\1" . "," . $row['alt_name'] . ".html\">\\2</a>";
                
                } else {
                    
                    $replacepage = "<a href=\"$PHP_SELF?newsid=" . $row['id'] . "&amp;news_page=\\1\">\\2</a>";
                }
                
                $row['full_story'] = preg_replace( "'\[PAGE=(.*?)\](.*?)\[/PAGE\]'si", $replacepage, $row['full_story'] );
            
            } else {
                
                $tpl->set( '{pages}', '' );
                $row['full_story'] = preg_replace( "'\[PAGE=(.*?)\](.*?)\[/PAGE\]'si", "", $row['full_story'] );
            }

2. В шаблоне fullstory.tpl добавить код:
<div align="center" class="navigation">{pages}</div>

Готово!
 
 
Автор: Sander
Источник:
  • Oxigen
  • 0
  • 432
Информация
Оставлять комментарии могут только зарегистрированные посетители.
  • Рейтинг@Mail.ru
  • Яндекс.Метрика