P
P
Pavel2016-04-12 20:05:14
DLE
Pavel, 2016-04-12 20:05:14

How to apply a different template for pinned news and only in one category?

There is a news section, you need to highlight the pinned news, but only in this section.
There is such a code, but it only works on the main one, but I need it in one category, for example, a category with ID 8.

Создаем файл в папке с вашим шаблоном: short-fixed.tpl, и редактируем этот файл под свой вкус и цвет.

Далее открываем файл /engine/modules/show.short.php

Ищем код: 
while ( $row = $db->get_row( $sql_result ) ) {
 
 
Ниже ставим этот код:
 
///шаблон для закреплённой новости (MSW) /// 
        if( isset( $view_template ) and $view_template == "rss" ) { } 
        elseif( $category_id and $cat_info[$category_id]['short_tpl'] != '' ) $tpl->load_template( $cat_info[$category_id]['short_tpl'] . '.tpl' ); 
        elseif($row["fixed"] == 1) $tpl->load_template( 'short-fixed.tpl' ); 
        else $tpl->load_template( 'shortstory.tpl' ); 
///шаблон для закреплённой новости (MSW) ///

Help me make this code apply only to one category and not to the main page. Since I have different short news templates for different categories.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question