Template Parent

Template Parent 1.0.1

Нет прав на скачивание
Совместимость с XF
  1. 2.3.x
  2. 2.2.x
Краткое описание
Add a new template variable in XenForo 2.2 to simplify conditional checks for threadview and forumview templates, reducing code complexity with an easier if statement.
Adds a new template variable $xf.reply.templateParent which groups all thread_view* and forum_view* templates together.

XenForo 2.2 adds multiple variations to the thread_view and forum_view templates for the various new thread types:

  • thread_view_type_article
  • thread_view_type_poll
  • thread_view_type_question
  • thread_view_type_suggestion
  • forum_view_type_article
  • forum_view_type_question
  • forum_view_type_suggestion
So now when you want to target a template conditional to a thread view page (for example, in an advert), instead of previously doing the following:
HTML:
<xf:if is="$xf.reply.template == 'thread_view'">
    <!-- do something -->
</xf:if>


... we must now do this:

HTML:
<xf:if is="in_array($xf.reply.template, [
                'thread_view',
                'thread_view_type_article',
                'thread_view_type_poll',
                'thread_view_type_question',
                'thread_view_type_suggestion'
               ])">
    <!-- do something -->
</xf:if>

An easier way

This addon adds a new template variable we can use to check if the template "parent" is thread_view or forum_view, so we can simply do the following instead to target all templates of that type:
HTML:
<xf:if is="$xf.reply.templateParent == 'thread_view'">
    <!-- do something for any thread view pages -->
</xf:if>
... or:
HTML:
<xf:if is="$xf.reply.templateParent == 'forum_view'">
    <!-- do something for any forum view pages -->
</xf:if>

Note that v1.0.1 or higher is required for XF 2.3 compatibility.
Автор
axtona
Просмотры
228
Тип расширения
zip
Размер файла
11.6 КБ
Первый выпуск
Последнее обновление
Оценки 0.00 звезды 0 оценок
Ссылка не работает? Отправить сообщение команде NP, и мы поможем вам очень быстро!
Поддержите разработчика Если вы довольны тестом или ваш проект приносит доход, нажмите кнопку «Больше информации», чтобы поддержать разработчика покупкой.

Больше Ресурсов от axtona

[XFSkins] Thread Rating A
Topic Rating plugin adds a clean and easy-to-understand star rating system to XenForo topics
Просмотры
2
Обновлено
 Aktieverketter A
Manager Asset дает администраторам XenForo видимый и организованный способ управлять изображениями
Просмотры
24
Обновлено
[FF] Login Spaminator Admin Area Logs A
Simple mod that allows you to browse the Spaminator logs from inside the admin area
Просмотры
253
Обновлено

Похожие ресурсы

[OzzModz] Template Modification List Tweaks A
Very quick and dirty addon for anyone who may find it useful
Просмотры
563
Обновлено
[OzzModz] Overlay Data Template Context A
Adds template context data parameter to the overlay HTML (used for styling by our addons)
Просмотры
315
Обновлено
 Разрешить изменение шаблона A
Как вы знаете, разработчики решили воспользоваться этим в версии 2.1.8
Просмотры
306
Обновлено
Назад
Вверх