IP.Board:Изображения форумов
Материал из CSI
Содержание |
[править] IP.Board 3.1
Иконки для форумов позволяют разнообразить и украсить отдельные форумы вашего портала. В этой статье я расскажу как можно сделать иконки без установки различных модификаций / хуков и прочей фигни. Необходимы только знания того, что делаем, к чему придём, и, что естественно — прямые руки.
Суть метода очень проста. Берётся переменная, которая вставляет в шаблон, а именно в ссылку, нумерованный идентификатор форумаНапример, у нас есть ссылка www.example.com/index.php?showforum=123, 123 - это и есть нумерованный идентификатор форума.. Иконки форумов будут иметь названия вида ID.png, где ID — нумерованный идентификатор форума и храниться в папке ./public/style_images/{ваш_стиль}/forum_icons/. Всё просто!
Список форумов → boardIndexTemplate, найти:
<th scope='col' class='col_c_icon'> </th>
Добавить ниже:
<!-- CSN Forum Icons --> <th scope='col' class='csn_ForumIcon'> </th> <!-- / CSN Forum Icons -->
Найти:
<td class='altrow'>{parse replacement="f_redirect"}</td>
Добавить ниже:
<!-- CSN Forum Icons --> <th scope='col' class='csn_ForumIcon'> </th> <!-- / CSN Forum Icons -->
Найти:
<td> <h4><a href="{parse url="showforum={$forum_data['id']}" seotitle="{$forum_data['name_seo']}" template="showforum" base="public"}" title='{$this->lang->words['go_to_forum']}'>{$forum_data['name']}</a></h4>
Добавить выше:
<!-- CSN Forum Icons --> <td><img class='csn_ForumIcon' src='{$this->settings['img_url']}/forum_icons/{$forum_data['id']}.png' alt='icon' /></td> <!-- / CSN Forum Icons -->
Список тем форума → forumIndexTemplate, найти:
<th scope='col' class='col_c_icon'> </th>
Добавить ниже:
<!-- CSN Forum Icons --> <th scope='col' class='csn_ForumIcon'> </th> <!-- / CSN Forum Icons -->
Найти:
<td class='altrow'>{parse replacement="f_redirect"}</td>
Добавить ниже:
<!-- CSN Forum Icons --> <th scope='col' class='csn_ForumIcon'> </th> <!-- / CSN Forum Icons -->
Найти:
<td> <h4><a href="{parse url="showforum={$forum_data['id']}" seotitle="{$forum_data['name_seo']}" template="showforum" base="public"}" title='{$this->lang->words['goto_forum']}'>{$forum_data['name']}</a></h4>
Добавить выше:
<!-- CSN Forum Icons --> <td><img class='csn_ForumIcon' src='{$this->settings['img_url']}/forum_icons/{$forum_data['id']}.png' alt='icon' /></td> <!-- / CSN Forum Icons -->
[править] IP.Board 3.0
Данная модификация шаблонов позволяет получить каждому форуму свою иконку.
Иконки форумов должны располагаться в папке ./public/style_images/<ваш_стиль>/forums_img/ и иметь названия вида forum_ID.png, где ID — это идентификатор форума.
Необходимо произвести изменения в двух шаблонах, а также подправить CSS. Итак, приступим.
Для начала откорректируем CSS. Идём в ipb_styles.css и добавляем туда (желательно в конец) следующее:
th.col_forum_icon { width: 64px; /* Размер иконок форума */ }
Теперь приступим к редактированию шаблонов…
Список форумов → boardIndexTemplate, найти:
<td> <h4><a href="{parse url="showforum={$forum_data['id']}" seotitle="{$forum_data['name_seo']}" template="showforum" base="public"}" title='{$this->lang->words['go_to_forum']}'>{$forum_data['name']}</a></h4>
Добавить ВЫШЕ:
<!-- (CSO) Forum Images --> <td><img src='{$this->settings['img_url']}/forums_img/forum_{$forum_data['id']}.png' alt='forum_{$forum_data['id']}' /></td> <!-- / (CSO) Forum Images -->
Найти:
<td colspan='2'> {$this->lang->words['rd_hits']}: {parse format_number="$forum_data['redirect_hits']"} </td>
Заменить на:
<td colspan='3'> {$this->lang->words['rd_hits']}: {parse format_number="$forum_data['redirect_hits']"} </td>
Найти:
<tr class='header'> <th scope='col' class='col_c_icon'> </th> <th scope='col' class='col_c_forum'>{$this->lang->words['cat_name']}</th> <th scope='col' class='col_c_stats stats'>{$this->lang->words['stats']}</th> <th scope='col' class='col_c_post'>{$this->lang->words['last_post_info']}</th> </tr>
Заменить на:
<tr class='header'> <th scope='col' class='col_c_icon'> </th> <th scope='col' class='col_forum_icon'> </th> <th scope='col' class='col_c_forum'>{$this->lang->words['cat_name']}</th> <th scope='col' class='col_c_stats stats'>{$this->lang->words['stats']}</th> <th scope='col' class='col_c_post'>{$this->lang->words['last_post_info']}</th> </tr>
Найти:
<td class='altrow'>{parse replacement="f_redirect"}</td>
Добавить НИЖЕ:
<!-- (CSO) Forum Images --> <td><img src='{$this->settings['img_url']}/forums_img/forum_{$forum_data['id']}.png' alt='forum_{$forum_data['id']}' /></td> <!-- / (CSO) Forum Images -->
Список тем форума → forumIndexTemplate, найти:
<td> <h4><a href="{parse url="showforum={$forum_data['id']}" seotitle="{$forum_data['name_seo']}" template="showforum" base="public"}" title='{$this->lang->words['goto_forum']}'>{$forum_data['name']}</a></h4>
Добавить ВЫШЕ:
<!-- (CSO) Forum Images --> <td><img src='{$this->settings['img_url']}/forums_img/forum_{$forum_data['id']}.png' alt='forum_{$forum_data['id']}' /></td> <!-- / (CSO) Forum Images -->
Найти:
<td colspan='2'> {$this->lang->words['rd_hits']}: {$forum_data['redirect_hits']} </td>
Заменить на:
<td colspan='3'> {$this->lang->words['rd_hits']}: {$forum_data['redirect_hits']} </td>
Найти:
<tr class='header'> <th scope='col' class='col_c_icon'> </th> <th scope='col' class='col_c_forum'>{$this->lang->words['cat_name']}</th> <th scope='col' class='col_c_stats stats'>{$this->lang->words['forum_stats']}</th> <th scope='col' class='col_c_post'>{$this->lang->words['last_post_info']}</th> </tr>
Заменить на:
<tr class='header'> <th scope='col' class='col_c_icon'> </th> <th scope='col' class='col_forum_icon'> </th> <th scope='col' class='col_c_forum'>{$this->lang->words['cat_name']}</th> <th scope='col' class='col_c_stats stats'>{$this->lang->words['forum_stats']}</th> <th scope='col' class='col_c_post'>{$this->lang->words['last_post_info']}</th> </tr>
Найти:
<td class='altrow'>{parse replacement="f_redirect"}</td>
Добавить НИЖЕ:
<!-- (CSO) Forum Images --> <td><img src='{$this->settings['img_url']}/forums_img/forum_{$forum_data['id']}.png' alt='forum_{$forum_data['id']}' /></td> <!-- / (CSO) Forum Images -->
[править] IP.Board 2.3
Недавно пришла ко мне идея показать вам, как можно сделать иконки для категорий и форумов руками, то есть без установки лишних модов и прочей мишуры
Делается это довольно просто. Например, можно сделать иконки для категорий. Давайте рассмотрим шаблон заголовка категории:
<div class="borderwrap" style="display:{$data['div_fc']}" id="fc_{$data['id']}"> <div class="maintitlecollapse"> <p class="expand"><a href="java script:togglecategory({$data['id']}, 0);"><{E_PLUS}></a></p> <p><{CAT_IMG}> <a href="{$this->ipsclass->base_url}showforum={$data['id']}">{$data['name']}</a></p> </div> </div> <div class="borderwrap" style="display:{$data['div_fo']}" id="fo_{$data['id']}"> <div class="maintitle"> <p class="expand"><a href="java script:togglecategory({$data['id']}, 1);"><{E_MINUS}></a></p> <p><{CAT_IMG}> <a href="{$this->ipsclass->base_url}showforum={$data['id']}">{$data['name']}</a></p> </div> <table class='ipbtable' cellspacing="1"> <tr> <th colspan="2" width="66%">{$this->ipsclass->lang['cat_name']}</th> <th style='text-align:center' width="7%">{$this->ipsclass->lang['topics']}</th> <th style='text-align:center' width="7%">{$this->ipsclass->lang['replies']}</th> <th width="35%">{$this->ipsclass->lang['last_post_info']}</th> </tr>
Смотрите, ссылка на категорию выглядит так:
<a href="{$this->ipsclass->base_url}showforum={$data['id']}">{$data['name']}</a>
где {$data['id']} — это ID категории. ID для каждой категории — оригинальный, то есть он не повторяется. Поэтому, его можно использовать для создания адреса картинки.
Адрес картинки будет выглядеть примерно так:
<img src="/папка_картинок/{$data['id']}.gif" alt="" />То есть, движок форума будет подхватывать этот адрес, а переменную {$data['id']} преобразовывать в «число-ID» категории. Тоже самое можно сделать и со списком форумов в категории.
Но чтобы нам как-то визуально отличать картинки форумов от картинок категории, можно приписать специальный префикс: для категорий:
<img src="/папка_картинок/cat_{$data['id']}.gif" alt="" />для форумов:
<img src="/папка_картинок/forum_{$data['id']}.gif" alt="" />
Теперь остаётся только создать папку «папка_картинок» и загрузить туда изображения.
Названия изображений нужно указывать таким шаблоном: cat_12.gif или forum_12.gif
Всё просто! :)