Template Parent

Template Parent 1.0.1

Keine Berechtigung zum Herunterladen
XF-Kompatibilität
  1. 2.3.x
  2. 2.2.x
Kurzbeschreibung
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.
Autor
axtona
Ansichten
228
Erweiterungstyp
zip
Dateigröße
11.6 KB
Erste Veröffentlichung
Letzte Aktualisierung
Bewertungen 0.00 Sterne 0 Bewertungen
Link defekt? Nachricht senden an das NP-Team – wir helfen dir schnell!
Unterstütze den Entwickler Wenn du mit dem Test zufrieden bist oder mit deinem Projekt erfolgreich Geld verdient hast, klicke auf den Button Mehr Informationen, um den Entwickler durch einen Kauf zu unterstützen.

Weitere Ressourcen von axtona

4SEO PRO - joomla seo plugin A
automatiere jeden Teil des SEO-Aufbaus, der automatisiert werden kann, aber lasst alles mit Easycustomisierbar bleiben.
[D-D] Kern A
[D-D] Kern 1.4.2
Core AddOn, der von jetzt an fast alle meine AddOns benötigen.
 Lettered Index A
Dieses Add-On fügt einem tabgeschriebenen Index von ausgewählten Foren eine Buchstabenfolge hinzu.

Ähnliche Ressourcen

 Erlauben Sie eine Modifikation des Vorlagen A
Wie Sie wissen, entschieden die Entwickler sich für die Gelegenheit in 2.1.8
Ansichten
306
Aktualisiert
[OzzModz] Overlay Data Template Context A
Adds template context data parameter to the overlay HTML (used for styling by our addons)
Ansichten
315
Aktualisiert
[OzzModz] Template Modification List Tweaks A
Very quick and dirty addon for anyone who may find it useful
Ansichten
564
Aktualisiert
Zurück
Oben