XF 2.0 Разные шаблоны

Статус
В этой теме нельзя размещать новые ответы.

nictic123

Проверенные
Сообщения
910
Реакции
928
Баллы
855
Добрый вечер! Интересует такое: чтобы один шаблон на телефоне и на компьютере отображался по-разному, т. е. чтобы содержимое для телефона и для компьютера отличалось. Возможно сделать?
 
Покажите Ваши попытки, мы поможем, если там реально были таковые.
Почему вы так вражески относитесь к посетителям вашего ресурса?
Странно что администрация так относится к простым пользователям этого ресурса...
 
Где это просматривается, мы не обязаны учить основам html и css, хотите подискутировать создайте отдельную тему, а мы знаем наших пользователей и даже если после наказания, они создают мультиаккаунт.
 
Почему вы так вражески относитесь к посетителям вашего ресурса?
Странно что администрация так относится к простым пользователям этого ресурса...
:facepalm: Просят показать, что человек сделал и от этого уже нужно смотреть. При чём тут вражда??? А Вы зачем отписались то вообще? Жизни нас поучить? Так это не по адресу, спасибо. :)
 
Покажите Ваши попытки, мы поможем, если там реально были таковые.
У меня получилось что-то такое:
Шаблон message_macros
Код:
<div class="hide-on-mobile">
 <xf:macro name="user_info"
    arg-user="!"
    arg-fallbackName=""
    arg-dateHtml=""
    arg-linkHtml="">
    
    <span class="message-userArrow"></span>
    <section itemscope itemtype="https://schema.org/Person" class="message-user">
        <h4 class="message-name"><xf:username user="$user" rich="true" defaultname="{$fallbackName}" itemprop="name" /></h4>
        <xf:usertitle user="$user" tag="h5" class="message-userTitle" banner="true" itemprop="jobTitle" />
        <div class="message-avatar {{ ($xf.options.showMessageOnlineStatus && $user && $user.isOnline()) ? 'message-avatar--online' : '' }}">
            <div class="message-avatar-wrapper">
                <xf:if is="property('uix_postBitAvatarSize') == 'small'">
                    <xf:avatar user="$user" size="s" defaultname="{$fallbackName}" itemprop="image" />
                <xf:elseif is="property('uix_postBitAvatarSize') == 'medium'" />
                    <xf:avatar user="$user" size="m" defaultname="{$fallbackName}" itemprop="image" />
                <xf:elseif is="property('uix_postBitAvatarSize') == 'large'" />
                    <xf:avatar user="$user" size="l" defaultname="{$fallbackName}" itemprop="image" />
                </xf:if>
                <xf:if is="$xf.options.showMessageOnlineStatus && $user && $user.isOnline()">
                    <span class="message-avatar-online" data-xf-init="tooltip" title="{{ phrase('online_now')|for_attr }}"></span>
                </xf:if>
            </div>
        </div>
        <div class="uix_messagePostBitWrapper">
            <div class="message-userDetails">
                <xf:userbanners user="$user" tag="div" class="message-userBanner" itemprop="jobTitle" />
                <xf:if is="{$dateHtml}"><div class="message-date">{$dateHtml}</div></xf:if>
            </div>
            <xf:if is="{$linkHtml}"><div class="message-permalink">{$linkHtml}</div></xf:if>
            <xf:if is="$user.user_id">
                <xf:set var="$extras" value="{{ property('messageUserElements') }}" />
                <xf:if contentcheck="true">
                    <xf:if is="property('uix_collapseExtraInfo')">
                        <div class="thThreads__message-userExtras">
                    </xf:if>
                            <div class="message-userExtras">
                                <xf:contentcheck>
                                    <xf:if is="$extras.register_date">
                                        <dl class="pairs pairs--justified">
                                            <dt>
                                                <xf:if is="property('uix_postBitIcons')">
                                                    <xf:macro name="icon" template="uix_icons.less" arg-icon="user" />
                                                <xf:else />
                                                    {{ phrase('joined') }}
                                                </xf:if>
                                            </dt>

                                            <dd>{{ date($user.register_date) }}</dd>
                                        </dl>
                                    </xf:if>
                                    <xf:if is="$extras.message_count">
                                        <dl class="pairs pairs--justified">
                                            <dt>
                                                <xf:if is="property('uix_postBitIcons')">
                                                    <xf:macro name="icon" template="uix_icons.less" arg-icon="messages" />
                                                <xf:else />
                                                    {{ phrase('messages') }}
                                                </xf:if>
                                            </dt>
                                            <dd>{$user.message_count|number}</dd>
                                        </dl>
                                    </xf:if>
                                    <xf:if is="$extras.like_count">
                                        <dl class="pairs pairs--justified">
                                            <dt>
                                                <xf:if is="property('uix_postBitIcons')">
                                                    <xf:macro name="icon" template="uix_icons.less" arg-icon="like" />
                                                <xf:else />
                                                        {{ phrase('likes') }}
                                                </xf:if>
                                            </dt>
                                            <dd>{$user.like_count|number}</dd>
                                        </dl>
                                    </xf:if>
                                    <xf:if is="$extras.trophy_points && $xf.options.enableTrophies">
                                        <dl class="pairs pairs--justified">
                                            <dt>
                                                <xf:if is="property('uix_postBitIcons')">
                                                    <xf:macro name="icon" template="uix_icons.less" arg-icon="trophy" />
                                                <xf:else />
                                                    {{ phrase('points') }}
                                                </xf:if>
                                            </dt>
                                            <dd>{$user.trophy_points|number}</dd>
                                        </dl>
                                    </xf:if>
                                    <xf:if is="$extras.age && $user.Profile.age">
                                        <dl class="pairs pairs--justified">
                                            <dt>
                                                <xf:if is="property('uix_postBitIcons')">
                                                    <xf:macro name="icon" template="uix_icons.less" arg-icon="birthday" />
                                                <xf:else />
                                                    {{ phrase('age') }}
                                                </xf:if>
                                            </dt>
                                            <dd>{$user.Profile.age}</dd>
                                        </dl>
                                    </xf:if>
                                    <xf:if is="$extras.location && $user.Profile.location">
                                        <dl class="pairs pairs--justified">
                                            <dt>
                                                <xf:if is="property('uix_postBitIcons')">
                                                    <xf:macro name="icon" template="uix_icons.less" arg-icon="location" />
                                                <xf:else />
                                                    {{ phrase('location') }}
                                                </xf:if>
                                            </dt>
                                            <dd><a href="{{ link('misc/location-info', '', {'location': $user.Profile.location}) }}" rel="nofollow" target="_blank" class="u-concealed">{$user.Profile.location}</a></dd>
                                        </dl>
                                    </xf:if>
                                    <xf:if is="$extras.website && $user.Profile.website">
                                        <dl class="pairs pairs--justified">
                                            <dt>
                                                <xf:if is="property('uix_postBitIcons')">
                                                    <xf:macro name="icon" template="uix_icons.less" arg-icon="web" />
                                                <xf:else />
                                                    {{ phrase('website') }}
                                                </xf:if>
                                            </dt>
                                            <dd><a href="{$user.Profile.website}" rel="nofollow" target="_blank">{$user.Profile.website|url('host', phrase('visit_site'))}</a></dd>
                                        </dl>
                                    </xf:if>
                                    <xf:if is="$extras.custom_fields">
                                        <xf:macro template="custom_fields_macros" name="custom_fields_values"
                                            arg-type="users"
                                            arg-group="personal"
                                            arg-set="{$user.Profile.custom_fields}"
                                            arg-additionalFilters="{{ ['message'] }}"
                                            arg-valueClass="pairs pairs--justified"
                                        />
                                        <xf:if is="$user.canViewIdentities()">
                                            <xf:macro template="custom_fields_macros" name="custom_fields_view"
                                                arg-type="users"
                                                arg-group="contact"
                                                arg-set="{$user.Profile.custom_fields}"
                                                arg-additionalFilters="{{ ['message'] }}"
                                                arg-valueClass="pairs pairs--justified"
                                            />
                                        </xf:if>
                                    </xf:if>
                                </xf:contentcheck>
                            </div>
                        <xf:if is="property('uix_collapseExtraInfo')">
                            </div>
                            <div class="thThreads__userExtra--toggle">
                                <span class="thThreads__userExtra--trigger"></span>
                            </div>
                        </xf:if>
                </xf:if>
            </xf:if>
        </div>
        <span class="message-userArrow"></span>
    </section>
 </xf:macro>
 
 <xf:macro name="user_info_simple" arg-user="!" arg-fallbackName="">
    <header itemscope itemtype="https://schema.org/Person" class="message-user">
        <meta itemprop="name" content="{{ $user.username ?: $fallbackName }}">
        <div class="message-avatar">
            <div class="message-avatar-wrapper">
                <xf:avatar user="$user" size="s" defaultname="{$fallbackName}" itemprop="image" />
            </div>
        </div>
        <span class="message-userArrow"></span>
    </header>
 </xf:macro>
 
 <xf:macro name="attachments" arg-attachments="!" arg-message="!" arg-canView="!">
    <xf:if contentcheck="true">
        <xf:css src="attachments.less" />
        <section class="message-attachments">
            <h4 class="block-textHeader">{{ phrase('attachments') }}</h4>
            <ul class="attachmentList">
                <xf:contentcheck>
                    <xf:foreach loop="$attachments" value="$attachment" if="!$message.isAttachmentEmbedded($attachment)">
                        <xf:macro template="attachment_macros" name="attachment_list_item"
                            arg-attachment="{$attachment}"
                            arg-canView="{$canView}" />
                    </xf:foreach>
                </xf:contentcheck>
            </ul>
        </section>
    </xf:if>
 </xf:macro>
 
 <xf:macro name="signature" arg-user="!">
    <xf:if is="$xf.visitor.Option.content_show_signature AND $user.Profile.signature">
        <xf:if contentcheck="true">
            <aside class="message-signature">
            <xf:contentcheck>
                {{ bb_code($user.Profile.signature, 'user:signature', $user) }}
            </xf:contentcheck>
            </aside>
        </xf:if>
    </xf:if>
 </xf:macro>
</div>
<div class="show-on-mobile">
 <xf:macro name="user_info"
    arg-user="!"
    arg-fallbackName=""
    arg-dateHtml=""
    arg-linkHtml="">
    
    <span class="message-userArrow"></span>
    <section itemscope itemtype="https://schema.org/Person" class="message-user">
        <h4 class="message-name"><xf:username user="$user" rich="true" defaultname="{$fallbackName}" itemprop="name" /></h4>
        <xf:usertitle user="$user" tag="h5" class="message-userTitle" banner="true" itemprop="jobTitle" /><br>
        <div class="message-avatar {{ ($xf.options.showMessageOnlineStatus && $user && $user.isOnline()) ? 'message-avatar--online' : '' }}">
            <div class="message-avatar-wrapper">
                <xf:if is="property('uix_postBitAvatarSize') == 'small'">
                    <xf:avatar user="$user" size="s" defaultname="{$fallbackName}" itemprop="image" />
                <xf:elseif is="property('uix_postBitAvatarSize') == 'medium'" />
                    <xf:avatar user="$user" size="m" defaultname="{$fallbackName}" itemprop="image" />
                <xf:elseif is="property('uix_postBitAvatarSize') == 'large'" />
                    <xf:avatar user="$user" size="l" defaultname="{$fallbackName}" itemprop="image" />
                </xf:if>
                <xf:if is="$xf.options.showMessageOnlineStatus && $user && $user.isOnline()">
                    <span class="message-avatar-online" data-xf-init="tooltip" title="{{ phrase('online_now')|for_attr }}"></span>
                </xf:if>
            </div>
        </div>
        <div class="uix_messagePostBitWrapper">
            <div class="message-userDetails">
                <xf:userbanners user="$user" tag="div" class="message-userBanner" itemprop="jobTitle" />
                <xf:if is="{$dateHtml}"><div class="message-date">{$dateHtml}</div></xf:if>
            </div>
            <xf:if is="{$linkHtml}"><div class="message-permalink">{$linkHtml}</div></xf:if>
            <xf:if is="$user.user_id">
                <xf:set var="$extras" value="{{ property('messageUserElements') }}" />
                <xf:if contentcheck="true">
                    <xf:if is="property('uix_collapseExtraInfo')">
                        <div class="thThreads__message-userExtras">
                    </xf:if>
                            <div class="message-userExtras">
                                <xf:contentcheck>
                                    <xf:if is="$extras.register_date">
                                        <dl class="pairs pairs--justified">
                                            <dt>
                                                <xf:if is="property('uix_postBitIcons')">
                                                    <xf:macro name="icon" template="uix_icons.less" arg-icon="user" />
                                                <xf:else />
                                                    {{ phrase('joined') }}
                                                </xf:if>
                                            </dt>

                                            <dd>{{ date($user.register_date) }}</dd>
                                        </dl>
                                    </xf:if>
                                    <xf:if is="$extras.message_count">
                                        <dl class="pairs pairs--justified">
                                            <dt>
                                                <xf:if is="property('uix_postBitIcons')">
                                                    <xf:macro name="icon" template="uix_icons.less" arg-icon="messages" />
                                                <xf:else />
                                                    {{ phrase('messages') }}
                                                </xf:if>
                                            </dt>
                                            <dd>{$user.message_count|number}</dd>
                                        </dl>
                                    </xf:if>
                                    <xf:if is="$extras.like_count">
                                        <dl class="pairs pairs--justified">
                                            <dt>
                                                <xf:if is="property('uix_postBitIcons')">
                                                    <xf:macro name="icon" template="uix_icons.less" arg-icon="like" />
                                                <xf:else />
                                                        {{ phrase('likes') }}
                                                </xf:if>
                                            </dt>
                                            <dd>{$user.like_count|number}</dd>
                                        </dl>
                                    </xf:if>
                                    <xf:if is="$extras.trophy_points && $xf.options.enableTrophies">
                                        <dl class="pairs pairs--justified">
                                            <dt>
                                                <xf:if is="property('uix_postBitIcons')">
                                                    <xf:macro name="icon" template="uix_icons.less" arg-icon="trophy" />
                                                <xf:else />
                                                    {{ phrase('points') }}
                                                </xf:if>
                                            </dt>
                                            <dd>{$user.trophy_points|number}</dd>
                                        </dl>
                                    </xf:if>
                                    <xf:if is="$extras.age && $user.Profile.age">
                                        <dl class="pairs pairs--justified">
                                            <dt>
                                                <xf:if is="property('uix_postBitIcons')">
                                                    <xf:macro name="icon" template="uix_icons.less" arg-icon="birthday" />
                                                <xf:else />
                                                    {{ phrase('age') }}
                                                </xf:if>
                                            </dt>
                                            <dd>{$user.Profile.age}</dd>
                                        </dl>
                                    </xf:if>
                                    <xf:if is="$extras.location && $user.Profile.location">
                                        <dl class="pairs pairs--justified">
                                            <dt>
                                                <xf:if is="property('uix_postBitIcons')">
                                                    <xf:macro name="icon" template="uix_icons.less" arg-icon="location" />
                                                <xf:else />
                                                    {{ phrase('location') }}
                                                </xf:if>
                                            </dt>
                                            <dd><a href="{{ link('misc/location-info', '', {'location': $user.Profile.location}) }}" rel="nofollow" target="_blank" class="u-concealed">{$user.Profile.location}</a></dd>
                                        </dl>
                                    </xf:if>
                                    <xf:if is="$extras.website && $user.Profile.website">
                                        <dl class="pairs pairs--justified">
                                            <dt>
                                                <xf:if is="property('uix_postBitIcons')">
                                                    <xf:macro name="icon" template="uix_icons.less" arg-icon="web" />
                                                <xf:else />
                                                    {{ phrase('website') }}
                                                </xf:if>
                                            </dt>
                                            <dd><a href="{$user.Profile.website}" rel="nofollow" target="_blank">{$user.Profile.website|url('host', phrase('visit_site'))}</a></dd>
                                        </dl>
                                    </xf:if>
                                    <xf:if is="$extras.custom_fields">
                                        <xf:macro template="custom_fields_macros" name="custom_fields_values"
                                            arg-type="users"
                                            arg-group="personal"
                                            arg-set="{$user.Profile.custom_fields}"
                                            arg-additionalFilters="{{ ['message'] }}"
                                            arg-valueClass="pairs pairs--justified"
                                        />
                                        <xf:if is="$user.canViewIdentities()">
                                            <xf:macro template="custom_fields_macros" name="custom_fields_view"
                                                arg-type="users"
                                                arg-group="contact"
                                                arg-set="{$user.Profile.custom_fields}"
                                                arg-additionalFilters="{{ ['message'] }}"
                                                arg-valueClass="pairs pairs--justified"
                                            />
                                        </xf:if>
                                    </xf:if>
                                </xf:contentcheck>
                            </div>
                        <xf:if is="property('uix_collapseExtraInfo')">
                            </div>
                            <div class="thThreads__userExtra--toggle">
                                <span class="thThreads__userExtra--trigger"></span>
                            </div>
                        </xf:if>
                </xf:if>
            </xf:if>
        </div>
        <span class="message-userArrow"></span>
    </section>
 </xf:macro>
 
 <xf:macro name="user_info_simple" arg-user="!" arg-fallbackName="">
    <header itemscope itemtype="https://schema.org/Person" class="message-user">
        <meta itemprop="name" content="{{ $user.username ?: $fallbackName }}">
        <div class="message-avatar">
            <div class="message-avatar-wrapper">
                <xf:avatar user="$user" size="s" defaultname="{$fallbackName}" itemprop="image" />
            </div>
        </div>
        <span class="message-userArrow"></span>
    </header>
 </xf:macro>
 
 <xf:macro name="attachments" arg-attachments="!" arg-message="!" arg-canView="!">
    <xf:if contentcheck="true">
        <xf:css src="attachments.less" />
        <section class="message-attachments">
            <h4 class="block-textHeader">{{ phrase('attachments') }}</h4>
            <ul class="attachmentList">
                <xf:contentcheck>
                    <xf:foreach loop="$attachments" value="$attachment" if="!$message.isAttachmentEmbedded($attachment)">
                        <xf:macro template="attachment_macros" name="attachment_list_item"
                            arg-attachment="{$attachment}"
                            arg-canView="{$canView}" />
                    </xf:foreach>
                </xf:contentcheck>
            </ul>
        </section>
    </xf:if>
 </xf:macro>
 
 <xf:macro name="signature" arg-user="!">
    <xf:if is="$xf.visitor.Option.content_show_signature AND $user.Profile.signature">
        <xf:if contentcheck="true">
            <aside class="message-signature">
            <xf:contentcheck>
                {{ bb_code($user.Profile.signature, 'user:signature', $user) }}
            </xf:contentcheck>
            </aside>
        </xf:if>
    </xf:if>
 </xf:macro>
</div>
Шаблон extra.less
Код:
.show-on-mobile {
    display: none;
}
@media only screen and (min-device-width : 320px) and (max-device-width : 480px) {
    .show-on-mobile {
        display: inline;
    }
}
.hide-on-mobile {
    display: inline;
}
@media only screen and (min-device-width : 320px) and (max-device-width : 480px) {
    .hide-on-mobile {
        display: none;
    }
}
 
Хм, у меня маленький вопрос, что Вы делаете в шаблонах...
Их править не желательно, от слова совсем для этого есть ТМС, но да ладно, если всё работает, но судя по соседней теме, уже что-то сломали.
 
Хм, у меня маленький вопрос, что Вы делаете в шаблонах...
Хочу изменить вид сообщений, так, чтобы они по-разному выглядели на телефоне и компьютере, а модификациями шаблонов пользоваться не умею :(
но судя по соседней теме, уже что-то сломали.
Там проблема с редактором, его я не трогал
 
Вид сообщения, можно и просто css изменить.
Там css недостаточно, надо именно расположение элементов поменять, причем, чтобы на телефоне и на компьютере оно различалось.
 
:facepalm: Просят показать, что человек сделал и от этого уже нужно смотреть. При чём тут вражда??? А Вы зачем отписались то вообще? Жизни нас поучить? Так это не по адресу, спасибо. :)
Да просто, много людей жалуются на не адекватное поведение админ состава, да и я еще умею читать, и различать когда человеку отвечают грубо, и это касается не только этого поста...
 
Наплевать кто и на что жалуется. Человек получает к себе такое отношение, как он сам относится к другим. А Вы главный выслушивальщик жалоб в интернете? Классная профессия. Если ещё где-то что-то не так во всемирной паутине - Вы не забывайте сюда отписываться. Вместе мы спасём мир!
 
А я вижу, что Вы один из заблокированных пользователей, а учить нас, как общаться с пользователями, давайте не будем.
Я давно писал, что я теперь общаюсь так, как со мной, больше нет желания подстравиваться под каждого, а потом всё равно узнавать, что тебя поливают грязью...
Вы видите, только что хотите видеть, а сколько отдаётся времени и сил пользователям, которые можно было бы отдать на семью, этого никто не видит, но вот упрекнуть, это хочет сделать каждый, в общем я всё сказал, больше не вижу смысла в этой бесполезной дискуссии.
 
Статус
В этой теме нельзя размещать новые ответы.
Современный облачный хостинг провайдер | Aéza
Назад
Сверху Снизу