вопрос
Нужно сделать полную копию стстемного модуля категории. Добавление, редактирование, удаление уже сделал.. Не могу найти где код модуля для пользовательской части сайта.. То есть какой код овечает за вывод новостей в категориях, подкатегориях и так далее.
Ответил: rashpil
engine/engine.php
Правда ещё в init.php довольно много кода для работы с категориями
// ################ Вывод отдельной категории #################
if ($do == "cat" and $category != '' and $subaction == '') {
$newsmodule = true;
if( $config['allow_alt_url'] == "yes" AND $config['seo_control'] AND $category_id AND $view_template != "rss") {
$re_cat = get_url( $category_id );
if ($re_cat != $_GET['category'] OR substr ( $_SERVER['REQUEST_URI'], - 1, 1 ) != '/' ) {
$re_url = explode ( "index.php", strtolower ( $_SERVER['PHP_SELF'] ) );
$re_url = reset ( $re_url );
header("HTTP/1.0 301 Moved Permanently");
header("Location: {$re_url}{$re_cat}/");
die("Redirect");
}
}
if (!$category_id) $category_id = 'not detected';
if ($allow_list[0] != "all") {
if (! $user_group[$member_id['user_group']]['allow_short'] and ! in_array ( $category_id, $allow_list )) $category_id = 'not detected';
}
if ($config['show_sub_cats']) $get_cats = get_sub_cats ( $category_id );
else $get_cats = $category_id;
if ($cat_info[$category_id]['news_sort'] != "") $news_sort_by = $cat_info[$category_id]['news_sort'];
if ($cat_info[$category_id]['news_msort'] != "") $news_direction_by = $cat_info[$category_id]['news_msort'];
if ($cat_info[$category_id]['news_number']) $config['news_number'] = $cat_info[$category_id]['news_number'];
if ($cstart) {
$cstart = $cstart - 1;
$cstart = $cstart * $config['news_number'];
}
$url_page = $config['http_home_url'] . get_url ( $category_id );
$user_query = "do=cat&category=" . $cat_info[$category_id]['alt_name'];
if ($config['allow_multi_category']) {
$where_category = "category regexp '[[:<:]](" . $get_cats . ")[[:>:]]'";
} else {
if ($config['show_sub_cats']) {
$get_cats = str_replace ( "|", "','", $get_cats );
$where_category = "category IN ('" . $get_cats . "')";
} else {
$where_category = "category = '{$get_cats}'";
}
}
if (isset ( $view_template ) and $view_template == "rss") {
$sql_select = "SELECT id, autor, date, short_story, full_story, xfields, title, category, alt_name FROM " . PREFIX . "_post WHERE {$where_category} AND approve=1" . $where_date . " ORDER BY date DESC LIMIT 0," . $config['rss_number'];
} else {
if (isset ( $_SESSION['dle_sort_cat'] )) $news_sort_by = $_SESSION['dle_sort_cat'];
if (isset ( $_SESSION['dle_direction_cat'] )) $news_direction_by = $_SESSION['dle_direction_cat'];
$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.f_year, 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 {$where_category} AND approve=1" . $where_date . " ORDER BY " . $fixed . $news_sort_by . " " . $news_direction_by . " LIMIT " . $cstart . "," . $config['news_number'];
$sql_count = "SELECT COUNT(*) as count FROM " . PREFIX . "_post WHERE {$where_category} AND approve=1" . $where_date;
}
Правда ещё в init.php довольно много кода для работы с категориями