Template Parent 1.0.3

XF 2.2 / 2.3 Template Parent 1.0.3

Add-on xenforo 2

Ressources et modules complémentaires pour XenForo 2

Styles xenforo 2

Styles / Thèmes et apparence pour xenforo 2

Templates xenforo 2

Codes pour modifier les templates sur xenforo 2

Section Premium

Add-on et Styles pour membre Premium
  • ⚠️ Section Premium. Réserver aux Membres Premium ⚠️
Template Parent 1.0.3

XF 2.2 / 2.3 Template Parent 1.0.3

Catégorie Catégorie Add-Ons
Titre du sujet Titre du sujet Template Parent 1.0.3
Auteur de la discussion Auteur de la discussion laurent68
Date de début Date de début
Réponses Réponses 3
Affichages Affichages 286
Réaction Réaction 0
Dernier message par Dernier message par laurent68

laurent68

Fondateur

Staff
fondateur
Réputation: 100%
Discussions
5 087
Messages
13 317
Solutions
85
J'aime
8 139
Points
198
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>

Télécharger V1.0.0b :

Version 1.0.1 : This release adds XF 2.3 compatibility - handing both short and expanded class names

Télécharger V1.0.1 :

Version 1.0.2 (2025-12-12)​

- run enqueuePostUpgradeCleanUp() during upgrades if we're running XF2.3+

Version 1.0.3 (2026-10-14)​

  • now requires XenForo 2.2.0 or later; earlier releases declared no XenForo version
  • declare that the add-on has no secret settings, through the hampel_admin_api_redaction code event, for add-ons that report a forum's configuration with secrets removed
Télécharger V1.0.3 :
 
Dernière édition:
Contenu similaire Les plus vues Voir plus
Retour
Haut Bas