Новые поступления в каждой категории 1.0.0

Вывод последних релизов с каждой категории на главной.

  1. Virtuoz
    Совместимость:
    не проверялся на совместимость
    Изменения в БД:
    не требуются
    Общественное достояние:
    да
    Описание: вывод последних релизов с каждой категории на главной
    Инструкция по установке:
    config.php

    добавить в конец

    Код:
    $bb_cfg['max_title']     = 70;   // макс длина title
    // kino
    $bb_cfg['kino_news']     = true;
    $bb_cfg['kino_count']    = 10;   // сколько выводить
    $bb_cfg['kino_forum_id'] = '74'; // нужные id  '1,2,3'
    // serial
    $bb_cfg['serial_news']     = true;
    $bb_cfg['serial_count']    = 10;   // сколько выводить
    $bb_cfg['serial_forum_id'] = '74'; // нужные id  '1,2,3'
    // prog
    $bb_cfg['prog_news']     = true;
    $bb_cfg['prog_count']    = 10;   // сколько выводить
    $bb_cfg['prog_forum_id'] = '74'; // нужные id  '1,2,3'
    // games
    $bb_cfg['games_news']     = true;
    $bb_cfg['games_count']    = 10;   // сколько выводить
    $bb_cfg['games_forum_id'] = '74'; // нужные id  '1,2,3'
    // music
    $bb_cfg['music_news']     = true;
    $bb_cfg['music_count']    = 10;   // сколько выводить
    $bb_cfg['music_forum_id'] = '74'; // нужные id  '1,2,3'
    // raznoe
    $bb_cfg['raznoe_news']     = true;
    $bb_cfg['raznoe_count']    = 10;   // сколько выводить
    $bb_cfg['raznoe_forum_id'] = '74'; // нужные id  '1,2,3'
    index.php

    найти

    Код:
    $datastore->enqueue(array(
        'stats',
        'moderators',
    ));
    добавить

    Код:
    if ($bb_cfg['kino_news']) $datastore->enqueue('kino');
    if ($bb_cfg['serial_news']) $datastore->enqueue('serial');
    if ($bb_cfg['prog_news']) $datastore->enqueue('prog');
    if ($bb_cfg['games_news']) $datastore->enqueue('games');
    if ($bb_cfg['music_news']) $datastore->enqueue('music');
    if ($bb_cfg['raznoe_news']) $datastore->enqueue('raznoe');
    найти

    Код:
    print_page('index.tpl');
    перед добавить

    Код:
    // kino
    if ($bb_cfg['kino_news'])
    {
        if (!$kino = $datastore->get('kino'))
        {
           $datastore->update('kino');
            $kino = $datastore->get('kino');
        }
    
        foreach ($kino as $row)
        {
            $template->assign_block_vars('kino', array(
                'TOPIC_ID' => $row['topic_id'],
                'TITLE'    => str_short($row['topic_title'], $bb_cfg['max_title']),
            ));
        }
    }
    // serial
    if ($bb_cfg['serial_news'])
    {
        if (!$serial = $datastore->get('serial'))
        {
           $datastore->update('serial');
            $serial = $datastore->get('serial');
        }
    
        foreach ($serial as $row)
        {
            $template->assign_block_vars('serial', array(
                'TOPIC_ID' => $row['topic_id'],
                'TITLE'    => str_short($row['topic_title'], $bb_cfg['max_title']),
            ));
        }
    }
    // prog
    if ($bb_cfg['prog_news'])
    {
        if (!$prog = $datastore->get('prog'))
        {
           $datastore->update('prog');
            $prog = $datastore->get('prog');
        }
    
        foreach ($prog as $row)
        {
            $template->assign_block_vars('prog', array(
                'TOPIC_ID' => $row['topic_id'],
                'TITLE'    => str_short($row['topic_title'], $bb_cfg['max_title']),
            ));
        }
    }
    // games
    if ($bb_cfg['games_news'])
    {
        if (!$games = $datastore->get('games'))
        {
           $datastore->update('games');
            $games = $datastore->get('games');
        }
    
        foreach ($games as $row)
        {
            $template->assign_block_vars('games', array(
                'TOPIC_ID' => $row['topic_id'],
                'TITLE'    => str_short($row['topic_title'], $bb_cfg['max_title']),
            ));
        }
    }
    // music
    if ($bb_cfg['music_news'])
    {
        if (!$music = $datastore->get('music'))
        {
           $datastore->update('music');
            $music = $datastore->get('music');
        }
    
        foreach ($music as $row)
        {
            $template->assign_block_vars('music', array(
                'TOPIC_ID' => $row['topic_id'],
                'TITLE'    => str_short($row['topic_title'], $bb_cfg['max_title']),
            ));
        }
    }
    // raznoe
    if ($bb_cfg['raznoe_news'])
    {
        if (!$raznoe = $datastore->get('raznoe'))
        {
           $datastore->update('raznoe');
            $raznoe = $datastore->get('raznoe');
        }
    
        foreach ($raznoe as $row)
        {
            $template->assign_block_vars('raznoe', array(
                'TOPIC_ID' => $row['topic_id'],
                'TITLE'    => str_short($row['topic_title'], $bb_cfg['max_title']),
            ));
        }
    }
    common.php

    найти

    Код:
            'smile_replacements'     => 'build_smilies.php',
    добавить

    Код:
            'kino'                   => 'build_cat_forums.php',
            'serial'                 => 'build_cat_forums.php',
            'prog'                   => 'build_cat_forums.php',
            'games'                  => 'build_cat_forums.php',
            'music'                  => 'build_cat_forums.php',
            'raznoe'                 => 'build_cat_forums.php',

    includes/datastore/build_cat_forums.php

    добавить в конец

    Код:
    if ($bb_cfg['kino_news'])
    {
        $data = DB()->fetch_rowset("SELECT tr.topic_id, tr.forum_id, t.topic_id, t.topic_time, t.topic_title, t.forum_id
            FROM  ". BB_BT_TORRENTS ." tr
                LEFT JOIN ". BB_TOPICS ." t  ON tr.topic_id = t.topic_id
                LEFT JOIN ". BB_FORUMS ." f  ON tr.forum_id = f.forum_id
            WHERE t.forum_id IN (". $bb_cfg['kino_forum_id'] .")
            ORDER BY tr.reg_time DESC LIMIT ". $bb_cfg['kino_count']);
        $this->store('kino', $data);
    }
    
    if ($bb_cfg['serial_news'])
    {
        $data = DB()->fetch_rowset("SELECT tr.topic_id, tr.forum_id, t.topic_id, t.topic_time, t.topic_title, t.forum_id
            FROM  ". BB_BT_TORRENTS ." tr
                LEFT JOIN ". BB_TOPICS ." t  ON tr.topic_id = t.topic_id
                LEFT JOIN ". BB_FORUMS ." f  ON tr.forum_id = f.forum_id
            WHERE t.forum_id IN (". $bb_cfg['serial_forum_id'] .")
            ORDER BY tr.reg_time DESC LIMIT ". $bb_cfg['serial_count']);
        $this->store('serial', $data);
    }
    
    if ($bb_cfg['prog_news'])
    {
        $data = DB()->fetch_rowset("SELECT tr.topic_id, tr.forum_id, t.topic_id, t.topic_time, t.topic_title, t.forum_id
            FROM  ". BB_BT_TORRENTS ." tr
                LEFT JOIN ". BB_TOPICS ." t  ON tr.topic_id = t.topic_id
                LEFT JOIN ". BB_FORUMS ." f  ON tr.forum_id = f.forum_id
            WHERE t.forum_id IN (". $bb_cfg['prog_forum_id'] .")
            ORDER BY tr.reg_time DESC LIMIT ". $bb_cfg['prog_count']);
        $this->store('prog', $data);
    }
    
    if ($bb_cfg['games_news'])
    {
        $data = DB()->fetch_rowset("SELECT tr.topic_id, tr.forum_id, t.topic_id, t.topic_time, t.topic_title, t.forum_id
            FROM  ". BB_BT_TORRENTS ." tr
                LEFT JOIN ". BB_TOPICS ." t  ON tr.topic_id = t.topic_id
                LEFT JOIN ". BB_FORUMS ." f  ON tr.forum_id = f.forum_id
            WHERE t.forum_id IN (". $bb_cfg['games_forum_id'] .")
            ORDER BY tr.reg_time DESC LIMIT ". $bb_cfg['games_count']);
        $this->store('games', $data);
    }
    
    if ($bb_cfg['music_news'])
    {
        $data = DB()->fetch_rowset("SELECT tr.topic_id, tr.forum_id, t.topic_id, t.topic_time, t.topic_title, t.forum_id
            FROM  ". BB_BT_TORRENTS ." tr
                LEFT JOIN ". BB_TOPICS ." t  ON tr.topic_id = t.topic_id
                LEFT JOIN ". BB_FORUMS ." f  ON tr.forum_id = f.forum_id
            WHERE t.forum_id IN (". $bb_cfg['music_forum_id'] .")
            ORDER BY tr.reg_time DESC LIMIT ". $bb_cfg['music_count']);
        $this->store('music', $data);
    }
    
    if ($bb_cfg['raznoe_news'])
    {
        $data = DB()->fetch_rowset("SELECT tr.topic_id, tr.forum_id, t.topic_id, t.topic_time, t.topic_title, t.forum_id
            FROM  ". BB_BT_TORRENTS ." tr
                LEFT JOIN ". BB_TOPICS ." t  ON tr.topic_id = t.topic_id
                LEFT JOIN ". BB_FORUMS ." f  ON tr.forum_id = f.forum_id
            WHERE t.forum_id IN (". $bb_cfg['raznoe_forum_id'] .")
            ORDER BY tr.reg_time DESC LIMIT ". $bb_cfg['raznoe_count']);
        $this->store('raznoe', $data);
    }
    page_header.tpl

    найти

    Код:
        <?php if (!empty($bb_cfg['sidebar1_static_content_path'])) include($bb_cfg['sidebar1_static_content_path']); ?>
        <img width="210" class="spacer" src="{SPACER}" alt="" />
    перед добавить

    Код:
    <script type="text/javascript" src="./misc/js/nreliz.min.js"></script>
    <!-- IF $bb_cfg['kino_news'] -->
    <table cellpadding="0" border="0" style="width: 100%;">
    <tr>
        <td class="cat_title" onclick="foo('blok_0')">
           <a style="cursor:pointer;"><img id="img_blok_0" src="./templates/default/images/icon_sign_minus.gif" style="margin-bottom:-3px;" />&nbsp; &nbsp;<strong>кино</strong></a>
        </td>
    </tr>
    <tr>
        <td>
            <div id="blok_0" style="display: block; font-size: 11px;">
                <!-- BEGIN kino -->
                <div style="margin-bottom: 1px; padding: 3px 0px 2px;">
                   <a href="viewtopic.php?t={kino.TOPIC_ID}">{kino.TITLE}</a>
                </div>
                <!-- END kino -->
            </div>
        </td>
        <script type="text/javascript">GetStatRel('blok_0');</script>
    </tr>
    </table>
    <!-- ENDIF -->
    
    <!-- IF $bb_cfg['serial_news'] -->
    <table cellpadding="0" border="0" style="width: 100%;">
    <tr>
        <td class="cat_title" onclick="foo('blok_1')">
           <a style="cursor:pointer;"><img id="img_blok_1" src="./templates/default/images/icon_sign_minus.gif" style="margin-bottom:-3px;" />&nbsp; &nbsp;<strong>сериалы</strong></a>
        </td>
    </tr>
    <tr>
        <td>
            <div id="blok_1" style="display: block; font-size: 11px;">
                <!-- BEGIN serial -->
                <div style="margin-bottom: 1px; padding: 3px 0px 2px;">
                   <a href="viewtopic.php?t={serial.TOPIC_ID}">{serial.TITLE}</a>
                </div>
                <!-- END serial -->
            </div>
        </td>
        <script type="text/javascript">GetStatRel('blok_1');</script>
    </tr>
    </table>
    <!-- ENDIF -->
    
    <!-- IF $bb_cfg['prog_news'] -->
    <table cellpadding="0" border="0" style="width: 100%;">
    <tr>
        <td class="cat_title" onclick="foo('blok_2')">
           <a style="cursor:pointer;"><img id="img_blok_2" src="./templates/default/images/icon_sign_minus.gif" style="margin-bottom:-3px;" />&nbsp; &nbsp;<strong>программы</strong></a>
        </td>
    </tr>
    <tr>
        <td>
            <div id="blok_2" style="display: block; font-size: 11px;">
                <!-- BEGIN prog -->
                <div style="margin-bottom: 1px; padding: 3px 0px 2px;">
                   <a href="viewtopic.php?t={prog.TOPIC_ID}">{prog.TITLE}</a>
                </div>
                <!-- END prog -->
            </div>
        </td>
        <script type="text/javascript">GetStatRel('blok_2');</script>
    </tr>
    </table>
    <!-- ENDIF -->
    
    <!-- IF $bb_cfg['games_news'] -->
    <table cellpadding="0" border="0" style="width: 100%;">
    <tr>
        <td class="cat_title" onclick="foo('blok_3')">
           <a style="cursor:pointer;"><img id="img_blok_3" src="./templates/default/images/icon_sign_minus.gif" style="margin-bottom:-3px;" />&nbsp; &nbsp;<strong>игры</strong></a>
        </td>
    </tr>
    <tr>
        <td>
            <div id="blok_3" style="display: block; font-size: 11px;">
                <!-- BEGIN games -->
                <div style="margin-bottom: 1px; padding: 3px 0px 2px;">
                   <a href="viewtopic.php?t={games.TOPIC_ID}">{games.TITLE}</a>
                </div>
                <!-- END games -->
            </div>
        </td>
        <script type="text/javascript">GetStatRel('blok_3');</script>
    </tr>
    </table>
    <!-- ENDIF -->
    
    <!-- IF $bb_cfg['music_news'] -->
    <table cellpadding="0" border="0" style="width: 100%;">
    <tr>
        <td class="cat_title" onclick="foo('blok_4')">
           <a style="cursor:pointer;"><img id="img_blok_4" src="./templates/default/images/icon_sign_minus.gif" style="margin-bottom:-3px;" />&nbsp; &nbsp;<strong>музыка</strong></a>
        </td>
    </tr>
    <tr>
        <td>
            <div id="blok_4" style="display: block; font-size: 11px;">
                <!-- BEGIN music -->
                <div style="margin-bottom: 1px; padding: 3px 0px 2px;">
                   <a href="viewtopic.php?t={music.TOPIC_ID}">{music.TITLE}</a>
                </div>
                <!-- END music -->
            </div>
        </td>
        <script type="text/javascript">GetStatRel('blok_4');</script>
    </tr>
    </table>
    <!-- ENDIF -->
    
    <!-- IF $bb_cfg['raznoe_news'] -->
    <table cellpadding="0" border="0" style="width: 100%;">
    <tr>
        <td class="cat_title" onclick="foo('blok_5')">
           <a style="cursor:pointer;"><img id="img_blok_5" src="./templates/default/images/icon_sign_minus.gif" style="margin-bottom:-3px;" />&nbsp; &nbsp;<strong>разное</strong></a>
        </td>
    </tr>
    <tr>
        <td>
            <div id="blok_5" style="display: block; font-size: 11px;">
                <!-- BEGIN raznoe -->
                <div style="margin-bottom: 1px; padding: 3px 0px 2px;">
                   <a href="viewtopic.php?t={raznoe.TOPIC_ID}">{raznoe.TITLE}</a>
                </div>
                <!-- END raznoe -->
            </div>
        </td>
        <script type="text/javascript">GetStatRel('blok_5');</script>
    </tr>
    </table>
    <!-- ENDIF -->

Пoследние рецензии

  1. Анонимный пользователь
    Анонимный пользователь
    1/5,
    Версия: 1.0.0
    Спер но до ума не довел
    1. Virtuoz
      Ответ автора
      Прежде чем, что то ляпнуть подумай 10 раз не будешь ли выглядеть клоуном.