Template Parent

Template Parent 1.0.1

Sem autorização para baixar
Compatibilidade com XF
  1. 2.3.x
  2. 2.2.x
Descrição curta
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
Visualizações
228
Tipo de extensão
zip
Tamanho do arquivo
11,6 KB
Primeiro lançamento
Última atualização
Avaliações 0,00 estrelas 0 avaliações
Link quebrado? Enviar mensagem para a equipe NP que vamos ajudá-lo rapidamente!
Apoie o desenvolvedor Se você está satisfeito com o teste ou seu projeto gerou lucro, clique no botão “Mais informações” para apoiar o desenvolvedor comprando.

Mais recursos de axtona

4seo pro - plugin de seo para joomla A
automatize todo o trabalho de SEO que possa ser automatizado, mas deixe tudo personalizável com facilidade
Visualizações
1.637
Atualizado
 Centro A
Centro 1.4.2
Addon Core que de agora em diante, quase todos meus Addons vão precisar.
Visualizações
642
Atualizado
 Lista de Indice A
Este Add-On adiciona um TabIndex alfabético aos fóruns selecionados.
Visualizações
947
Atualizado

Recursos similares

 Permitir Modificações A
Como você sabe, os desenvolvedores decidiram aproveitar a oportunidade na versão 2.1.8
Visualizações
306
Atualizado
[OzzModz] Overlay Data Template Context A
Adds template context data parameter to the overlay HTML (used for styling by our addons)
Visualizações
315
Atualizado
[OzzModz] Template Modification List Tweaks A
Very quick and dirty addon for anyone who may find it useful
Visualizações
564
Atualizado
Voltar
Top