XF 2.2 Hide titleBoard on articles and threads

fiebrelectora

Active member
Hi huys!


I am trying to hide the titleboard only on the main page and in the nodes, so that it does not appear in threads or articles.

I have used this conditional but it works on the main page, threads and articles, but not on the nodes, where is the error?


PAGE_CONTAINER

<xf:if is="$template == 'forum_list'">
<title><xf:title formatter="%s" fallback="{$xf.options.boardTitle}" page="{$pageNumber}" /></title>
<xf:elseif is="$template == 'forum_view_type_article'"/>
<title><xf:title formatter="%s" fallback="{$xf.options.boardTitle}" page="{$pageNumber}" /></title>
<xf:else />
<title><xf:title formatter="%s" page="{$pageNumber}" /></title>
</xf:if>
 
You need to add the forum_view template(s) to the first if statement but you can simplify it by adding all three templates to the first if statement as an array.

HTML:
<xf:if is="in_array($xf.reply.template, ['forum_list', 'forum_view', 'forum_view_type_article'])">
    Do something
<xf:else/>
    Do something else
</xf:if>

Add other templates to the array as needed.
 
Thanks Brogan, but I'm still having the same problem. In the nodes only the name of the node is shown, but it does not include the title of the website at the end.


HTML:
<xf:if is="in_array($xf.reply.template, ['forum_list', 'forum_view', 'forum_view_type_article'])">
<title><xf:title formatter="%s" fallback="{$xf.options.boardTitle}" page="{$pageNumber}" /></title>   
<xf:else />
<title><xf:title formatter="%s"  page="{$pageNumber}" /></title>
</xf:if>
 
Most likely $xf.reply.template is the issue - dump that var in the PAGE_CONTAINER template to see what the template name is for each page you are applying that change.
 
I think I have detected the error, I was using the code:

formatter="%s" instead of formatter="%s | %s"

This code works now:

HTML:
<xf:if is="in_array($xf.reply.template, ['forum_list', 'forum_view', 'forum_view_type_article'])">
<title><xf:title formatter="%s | %s" fallback="{$xf.options.boardTitle}" page="{$pageNumber}" /></title>
<xf:elseif is="$template == 'forum_view_type_article'"/>
<xf:else />
<title><xf:title formatter="%s" page="{$pageNumber}" /></title>
</xf:if >
 
Top Bottom