6.08.13, 13:42
0 комментарий
  DLE Модули

Сортировка и поиск новостей по 1 букве для DLE 9.8-10.0

Модуль,или же хак,предназначен для сортировки и поиску новостей по 1 букве.
Тестировалось на DLE 9.8

Установка:

1.Залить файл в папку с шаблоном.
2.Открыть engine/engine.php
Найти:

} elseif ($catalog != "") {
			// ################ Вывод по буквенному идентификатору #################
			if ($cstart) {
				$cstart = $cstart - 1;
				$cstart = $cstart * $config['news_number'];
			}

			$newsmodule = true;
			
			$url_page = $config['http_home_url'] . "catalog/" . urlencode ( $catalog );
			$user_query = "catalog=" . urlencode ( $catalog );
			
			$news_sort_by = ($config['catalog_sort']) ? $config['catalog_sort'] : "date";
			$news_direction_by = ($config['catalog_msort']) ? $config['catalog_msort'] : "DESC";
			
			if (isset ( $_SESSION['dle_sort_catalog'] )) $news_sort_by = $_SESSION['dle_sort_catalog'];
			if (isset ( $_SESSION['dle_direction_catalog'] )) $news_direction_by = $_SESSION['dle_direction_catalog'];
			
			$sql_select = "SELECT p.id, p.autor, p.date, p.short_story, CHAR_LENGTH(p.full_story) as full_story, p.xfields, p.title, p.category, p.alt_name, p.comm_num, p.allow_comm, p.fixed, p.tags, e.news_read, e.allow_rate, e.rating, e.vote_num, e.votes, e.view_edit, e.editdate, e.editor, e.reason FROM " . PREFIX . "_post p LEFT JOIN " . PREFIX . "_post_extras e ON (p.id=e.news_id) WHERE {$stop_list}symbol = '$catalog' AND approve=1" . $where_date . " ORDER BY " . $news_sort_by . " " . $news_direction_by . " LIMIT " . $cstart . "," . $config['news_number'];
			$sql_count = "SELECT COUNT(*) as count FROM " . PREFIX . "_post WHERE {$stop_list}symbol = '$catalog' AND approve=1" . $where_date;


Заменить до } else { на:

} elseif ($catalog != "" and $_GET['n']) {
		// ################ Вывод по буквенному идентификатору N #################
if ($cstart) {
$cstart = $cstart - 1;
$cstart = $cstart * $config['news_number'];
}
$newsmodule = true;
$url_page = $config['http_home_url'] . "cat/" . urlencode ( $catalog );
$user_query = "cat=" . urlencode ( $catalog );

$news_sort_by = ($config['catalog_sort']) ? $config['catalog_sort'] : "date";
$news_direction_by = ($config['catalog_msort']) ? $config['catalog_msort'] : "DESC";

if (isset ( $_SESSION['dle_sort_catalog'] )) $news_sort_by = $_SESSION['dle_sort_catalog'];
if (isset ( $_SESSION['dle_direction_catalog'] )) $news_direction_by = $_SESSION['dle_direction_catalog'];

$sql_select = "SELECT id, autor, date, short_story, SUBSTRING(full_story, 1, 15) as full_story, xfields, title, category, alt_name, comm_num, allow_comm, approve, tags FROM " . PREFIX . "_post WHERE {$stop_list}title LIKE '$catalog%' AND approve" . $where_date . " ORDER BY " . $news_sort_by . " " . $news_direction_by . " LIMIT " . $cstart . "," . $config['news_number'];
$sql_count = "SELECT COUNT(*) as count FROM " . PREFIX . "_post WHERE {$stop_list}title LIKE '$catalog%' AND approve" . $where_date;


3. Открыть ./htaссess
Найти:

RewriteRule ^catalog/([^/]*)(/?)+$ index.php?catalog=$1 [L]
RewriteRule ^catalog/([^/]*)/page/([0-9]+)(/?)+$ index.php?catalog=$1&cstart=$2 [L]


Ниже добавить:

# вывод в виде каталога
RewriteRule ^cat/([^/]*)(/?)+$ index.php?catalog=$1&n=1 [L]
RewriteRule ^cat/([^/]*)/page/([0-9]+)(/?)+$ index.php?catalog=$1&cstart=$2&n=1 [L]


4. Открыть templates/Ваш шаблон/main.tpl
В любом удобном месте вставить:

{include file="letters.tpl"}


Название: Сортировка и поиск новостей по 1 букве. [DLE 9.8-10.0]
Версия DLE: DLE 9.8-10.0

СКАЧАТЬ

Вес файла
1.83 Kb

Напишите своё мнение