Template Parent

Template Parent 1.0.1

No tiene permiso para descargar
Compatibilidad con XF
  1. 2.3.x
  2. 2.2.x
Descripción breve
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
Vistas
228
Tipo de extensión
zip
Tamaño de archivo
11,6 KB
Primer lanzamiento
Última actualización
Valoraciones 0,00 estrella(s) 0 valoraciones
¿Enlace roto? Enviar mensaje al equipo NP y te ayudaremos rápidamente!
Apoia al desarrollador i estás satisfecho con la prueba o tu proyecto te ha generado ganancias, haz clic en el botón «Más información» para apoyar al desarrollador comprando.

Más recursos de axtona

4seo PRO - plugin de SEO para Joomla A
automaté todo lo que pueda automatarse en SEO, pero deja que personalices todo con facilidad
 Correo A
Correo 1.4.2
Addon Core que de ahora en adelante casi todos mis Addons requerirán.
 Indice de Letras A
Esta AddOn añade un índice Letrado al TabIndex de foros seleccionados.

Recursos similares

[OzzModz] Template Modification List Tweaks A
Very quick and dirty addon for anyone who may find it useful
[OzzModz] Overlay Data Template Context A
Adds template context data parameter to the overlay HTML (used for styling by our addons)
 Permit Modificación de Plantilla A
Como sabes, los desarrolladores decidieron tomar la oportunidad en 2.1.8
Atrás
Superior