To jest tylko wersja do druku, aby zobaczyć pełną wersję tematu, kliknij TUTAJ
phpBB2 by Przemo
Support forów phpBB2 modified by Przemo

1.12.7 i starsze - Sortowanie alfabetyczne tematów

xlesiu - 24-06-2009, 00:54
Temat postu: Sortowanie alfabetyczne tematów
Sortowanie alfabetyczne tematów

Opis:
Sortowanie alfabetyczne tematów
Cytat:
##############################################################
## MOD Title: Sortowanie alfabetyczne tematów
## MOD Author: pentapenguin < pentapenguin@bluebottle.com > (Jeremy Conley)
## MOD Description: Sortowanie alfabetyczne tematów
## MOD Version: 0.2.0
##
## Installation Level: Easy
## Installation Time: 10 Minutes
##
## Files To Edit: 3
## viewforum.php
## langauge/lang_polish/lang_main.php
## templates/NazwaStylu/viewforum_body.tpl
##
## Included Files: n/a
##
## License: http://opensource.org/licenses/gpl-license.php GNU General Public License v2
##############################################################


[ Dodano: 24-06-2009, 00:57 ]
Mogą być problemy z tematami z polskimi literami

adrian507120 - 24-06-2009, 01:35

xlesiu, jesteś wielki dziękuje za moda
Macintosh - 20-11-2009, 20:02

Fajnie, że już jest takie coś w BB by Przemo. :|
MaTeK_ - 20-11-2009, 20:07

Macintosh, no to pokaż .. ;x
Jest tylko układ alfabetyczny a nie sortowanie co do wskazaniej litery

Bucu - 20-11-2009, 20:48

Brakuje tematow zaczynajacych sie liczbami - dopisalem.

otwieramy viewforum.php i znajdujemy:

Kod:
$letters_array = array('0-9','A', 'B', 'C', 'Ć', 'D', 'E', 'Ę', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'Ł', 'M', 'N', 'Ń', 'O', 'Ó', 'P', 'Q', 'R', 'S', '&#166;', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '&#172;', 'Ż');


i zamieniamy na:
Kod:
$letters_array = array('A', 'B', 'C', 'Ć', 'D', 'E', 'Ę', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'Ł', 'M', 'N', 'Ń', 'O', 'Ó', 'P', 'Q', 'R', 'S', '&#166;', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '&#172;', 'Ż');


znajdujemy:
Kod:
if ( $start_letter )
    {
        $sql = 'SELECT COUNT(topic_id) AS forum_topics
            FROM ' . TOPICS_TABLE . "
            WHERE forum_id = $forum_id
                AND topic_title LIKE '$start_letter%'";
           
        if ( !($result = $db->sql_query($sql)) )
        {
            message_die(GENERAL_ERROR, 'Could not get topic counts for letter search', '', __LINE__, __FILE__, $sql);
        }
       
        $row = $db->sql_fetchrow($result);
       
        $topics_count = ( $row['forum_topics'] ) ? $row['forum_topics'] : 1;
       
        $db->sql_freeresult($result);
    }


i zamieniamy na:
Kod:

    if ( $start_letter )
    {   
        if ( $start_letter == '0-9' )
        {
        $sql = 'SELECT COUNT(topic_id) AS forum_topics
            FROM ' . TOPICS_TABLE . '
            WHERE `forum_id` = $forum_id
                AND `topic_title` RLIKE "^[0-9]"';
        }       
        else
        {       
        $sql = 'SELECT COUNT(topic_id) AS forum_topics
            FROM ' . TOPICS_TABLE . "
            WHERE forum_id = $forum_id
                AND topic_title LIKE '$start_letter%'";
        }
       
        if ( !($result = $db->sql_query($sql)) )
        {
            message_die(GENERAL_ERROR, 'Could not get topic counts for letter search', '', __LINE__, __FILE__, $sql);
        }
       
        $row = $db->sql_fetchrow($result);
       
        $topics_count = ( $row['forum_topics'] ) ? $row['forum_topics'] : 1;
       
        $db->sql_freeresult($result);
    }


i znajdujemy:
Kod:
$sql = "SELECT " . $sql_fields . "
    FROM (" . $sql_tables . ")
    $ignore_topics_table
    WHERE t.forum_id = $forum_id
        $ignore_topics_sql
        AND t.topic_poster = u.user_id
        AND p.post_id = t.topic_first_post_id
        AND p2.post_id = t.topic_last_post_id
        AND u2.user_id = p2.poster_id
        $forum_post_text_where
        AND t.topic_type <> " . POST_ANNOUNCE . "
        AND t.topic_title LIKE '$start_letter%'
        AND t.topic_type <> " . POST_GLOBAL_ANNOUNCE . "
        $limit_topics_time $sotr_methods
    LIMIT $start, $user_topics_per_page";


i zamieniamy na:

Kod:
if ( $start_letter == '0-9' )
{
$sql = "SELECT " . $sql_fields . "
    FROM (" . $sql_tables . ")
    $ignore_topics_table
    WHERE t.forum_id = $forum_id
        $ignore_topics_sql
        AND t.topic_poster = u.user_id
        AND p.post_id = t.topic_first_post_id
        AND p2.post_id = t.topic_last_post_id
        AND u2.user_id = p2.poster_id
        $forum_post_text_where
        AND t.topic_type <> " . POST_ANNOUNCE . "
        AND t.topic_title RLIKE '^[0-9]'
        AND t.topic_type <> " . POST_GLOBAL_ANNOUNCE . "
        $limit_topics_time $sotr_methods
    LIMIT $start, $user_topics_per_page";       
}       
else
{       
$sql = "SELECT " . $sql_fields . "
    FROM (" . $sql_tables . ")
    $ignore_topics_table
    WHERE t.forum_id = $forum_id
        $ignore_topics_sql
        AND t.topic_poster = u.user_id
        AND p.post_id = t.topic_first_post_id
        AND p2.post_id = t.topic_last_post_id
        AND u2.user_id = p2.poster_id
        $forum_post_text_where
        AND t.topic_type <> " . POST_ANNOUNCE . "
        AND t.topic_title LIKE '$start_letter%'
        AND t.topic_type <> " . POST_GLOBAL_ANNOUNCE . "
        $limit_topics_time $sotr_methods
    LIMIT $start, $user_topics_per_page";
}


[ Dodano: 20-11-2009, 20:49 ]
pierwszy fragment kodu zle dodalem - znajdujemy oczywiscie

Kod:
$letters_array = array('A', 'B', 'C', 'Ć', 'D', 'E', 'Ę', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'Ł', 'M', 'N', 'Ń', 'O', 'Ó', 'P', 'Q', 'R', 'S', '&#166;', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '&#172;', 'Ż');


i zamieniamy na:
Kod:
$letters_array = array('0-9','A', 'B', 'C', 'Ć', 'D', 'E', 'Ę', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'Ł', 'M', 'N', 'Ń', 'O', 'Ó', 'P', 'Q', 'R', 'S', '&#166;', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '&#172;', 'Ż')


prosze moderatora o poprawienie mojego posta.

kabar - 14-02-2010, 12:45

Czy to sortowanie możemy włączyć dla konkretnych for?
MagicalFire - 11-04-2010, 10:03

Bucu, podaj cała instrukcje
pozatym na koncu
Kod:
$letters_array = array('0-9','A', 'B', 'C', 'Ć', 'D', 'E', 'Ę', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'Ł', 'M', 'N', 'Ń', 'O', 'Ó', 'P', 'Q', 'R', 'S', '&#166;', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '&#172;', 'Ż')


bowinien byc ;



Powered by phpBB modified by Przemo © 2003 phpBB Group