Х
Хортица
Прохожие
- Автор темы
- #1
Follow along with the video below to see how to install our site as a web app on your home screen.
Примечание: This feature may not be available in some browsers.
Тебе делать на ajax ? А так модуль простенький. Завтра прийду с бильярда обезательно зделаю по просбе Хортыця
Описание: Хак позволяет сортировать посты по: РЕЙТИНГУ / ПОСЕЩАИМОСТИ / САМЫЕ КОММЕНТИРУЕМЫЕ
Возможности: Пролистывание, просмотр любой страници в отсортированном порядке.
Установка
Oткрываем файл engine/engine.php
Ищем:
$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, allow_rate, rating, vote_num, news_read, flag FROM " . PREFIX . "_post WHERE {$stop_list}approve = '1' AND allow_main = '1'".$where_date." ORDER BY fixed desc, ".$config['news_sort']." ".$config['news_msort']." LIMIT ".$cstart.",".$config['news_number'];
$sql_count = "SELECT COUNT(*) as count FROM " . PREFIX . "_post WHERE {$stop_list}approve = '1' AND allow_main = '1'".$where_date;
Вместо этого вставляем :
if (isset($_GET['rating']) && $_GET['rating'] != "")
{
$config['allow_cache'] = false;
$addsql = "ORDER BY rating DESC, ".$config['news_sort']." ".$config['news_msort']."";
$url_page = $config['http_home_url']."ratingorder";
}
else
if (isset($_GET['mostcomment']) && $_GET['mostcomment'] != "")
{
$config['allow_cache'] = false;
$addsql = "ORDER BY comm_num DESC, ".$config['news_sort']." ".$config['news_msort']."";
$url_page = $config['http_home_url']."commorder";
}
else
if (isset($_GET['mostread']) && $_GET['mostread'] != "")
{
$config['allow_cache'] = false;
$addsql = "ORDER BY news_read DESC, ".$config['news_sort']." ".$config['news_msort']."";
$url_page = $config['http_home_url']."readorder";
}
else
if(!isset($_GET['rating']) and !isset($_GET['mostcomment']) and !isset($_GET['mostread']))
$addsql = "ORDER BY fixed desc, ".$config['news_sort']." ".$config['news_msort']."";
$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, allow_rate, rating, vote_num, news_read, flag FROM " . PREFIX . "_post WHERE {$stop_list}approve = '1' AND allow_main = '1'".$where_date." ".$addsql." LIMIT ".$cstart.",".$config['news_number'];
$sql_count = "SELECT COUNT(*) as count FROM " . PREFIX . "_post WHERE {$stop_list}approve = '1' AND allow_main = '1'".$where_date;
откройте файл .htaccess в корне сайта и после строки RewriteEngine On, добавьте следующие строки:
# order by
RewriteRule ^ratingorder(/?)+$ index.php?rating=1 [L]
RewriteRule ^ratingorder/page/([0-9]+)(/?)+$ index.php?rating=1&cstart=$1 [L]
RewriteRule ^commorder(/?)+$ index.php?mostcomment=1 [L]
RewriteRule ^commorder/page/([0-9]+)(/?)+$ index.php?mostcomment=1&cstart=$1 [L]
RewriteRule ^readorder(/?)+$ index.php?mostread=1 [L]
RewriteRule ^readorder/page/([0-9]+)(/?)+$ index.php?mostread=1&cstart=$1 [L]
Oткрываем файл templates/default/main.tpl
Ищем:
{speedbar}
После вставляем :
[aviable=main]<div style=" padding-right:10px; float:right;"> сортировать посты по: <a href="/ratingorder/">РЕЙТИНГУ</a> | <a href="/readorder/">ПОСЕЩАИМОСТИ</a> | <a href="/commorder/">САМЫЕ КОММЕНТИРУЕМЫЕ</a> </div>
<br />[/aviable]
Это хорошо...Только не работает в категориях...
Готов заплатить за доработку этого хака, чтобы такой вывод можно было реализовать и во всех категориях сайта.
if (isset($view_template) AND $view_template == "rss") {
$sql_select = "SELECT id, autor, date, short_story, full_story, xfields, title, category, alt_name, flag FROM " . PREFIX . "_post WHERE {$where_category} AND approve = '1'".$where_date." ORDER BY fixed desc, ".$config['news_sort']." ".$config['news_msort']." LIMIT 0,".$config['rss_number'];
} else {
$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, allow_rate, rating, vote_num, news_read, flag FROM " . PREFIX . "_post WHERE {$where_category} AND approve = '1'".$where_date." ORDER BY fixed desc, ".$config['news_sort']." ".$config['news_msort']." LIMIT ".$cstart.",".$config['news_number'];
$sql_count = "SELECT COUNT(*) as count FROM " . PREFIX . "_post WHERE {$where_category} AND approve = '1'".$where_date;
}
ORDER BY fixed desc, ".$config['news_sort']." ".$config['news_msort']."
$addsql
if (isset($view_template) AND $view_template == "rss") {
$sql_select = "SELECT id, autor, date, short_story, full_story, xfields, title, category, alt_name, flag FROM " . PREFIX . "_post WHERE {$where_category} AND approve = '1'".$where_date." ORDER BY fixed desc, ".$config['news_sort']." ".$config['news_msort']." LIMIT 0,".$config['rss_number'];
} else {
$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, allow_rate, rating, vote_num, news_read, flag FROM " . PREFIX . "_post WHERE {$where_category} AND approve = '1'".$where_date." $addsql LIMIT ".$cstart.",".$config['news_number'];
$sql_count = "SELECT COUNT(*) as count FROM " . PREFIX . "_post WHERE {$where_category} AND approve = '1'".$where_date;
}