Administrator ANDROS Posted December 13, 2015 Administrator Share Posted December 13, 2015 Позволяет выводить список всех новостей в алфавитном порядке. Установка: Открываем index.php и находим: $tpl->load_template ( 'main.tpl' ); Ставим выше: /*Меню алфавитное*/ $alfa_menu = dle_cache( "menu_for_main", $config['skin'], true ); if ($alfa_menu === FALSE) { $serials_alfa = Array(); $cats = $db->query("SELECT id,date,title,category,alt_name FROM " . PREFIX . "_post ORDER BY title ASC"); while ($row = $db->get_row($cats)) { if (ord(substr($row['title'], 0, 1)) >= 48 AND ord(substr($row['title'], 0, 1)) <= 57) $symbol = "0-9"; elseif ((ord(strtoupper(substr($row['title'], 0, 1))) >= 65) AND (ord(strtoupper(substr($row['title'], 0, 1))) <= 90)) $symbol = "A-Z"; else $symbol = ord(substr($row['title'], 0, 1)); $serials_alfa[$symbol][$row['id']] = $row; } $tpl1 = new dle_template(); $tpl1->dir = TEMPLATE_DIR; $tpl1->load_template( 'menu_block.tpl' ); foreach ($serials_alfa as $id => $array) { if ($id == '0-9' OR $id == 'A-Z') $tpl1->set("{symbol}", $id); else $tpl1->set("{symbol}", chr($id)); $tpl1->set("{col}", count($array)); $tpl12 = new dle_template(); $tpl12->dir = TEMPLATE_DIR; $tpl12->load_template( 'menu_link.tpl' ); foreach ($array as $key => $info) { $link = $config['http_home_url'] .$info['id']."-". $info['alt_name'] . ".html"; $tpl12->set( '[full-link]', "<a href=\"" . $link . "\">" ); $tpl12->set( '[/full-link]', "</a>" ); $tpl12->set( '{name}', $info['title'] ); $tpl12->set( '{alt_name}', $info['metatitle'] ); $tpl12->set( '{id}', $info['id'] ); $tpl12->compile( 'menu_links' ); } $tpl1->set("{menu_links}", $tpl12->result['menu_links']); unset($tpl12); $tpl1->compile( 'alfa_menu' ); } $alfa_menu = $tpl1->result['alfa_menu']; unset($tpl1); create_cache( "menu_for_main", $alfa_menu, $config['skin'], true ); } $tpl->set("{menu}", $alfa_menu); В шаблоне main.tpl подключаем: {menu} ✔ Наши пользователи помогли вам решить проблему? 💸 Наградите их реакцией и поддержите наш форум оформив подписку! 💎 Покупая премиум вы получаете дополнительные возможности и тем самым поддерживаете нас в продолжении! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now