XF 1.3 $contentTemplate conditional?

Floren

Well-known member
Hi,

I changed how the title displays in PAGE_CONTAINER with this conditional:
Code:
    <title><xen:if is="{$title}">
        {xen:raw $title} | {$xenOptions.boardTitle}
    <xen:else />
        <xen:if is="{$contentTemplate} == 'forum_list'">
            {$xenOptions.boardTitle} {xen:phrase forums}
        <xen:elseif is="{$contentTemplate} == 'resource_index'" />
            {$xenOptions.boardTitle} {xen:phrase resources}
        <xen:else />
            {$xenOptions.boardTitle}
        </xen:if>
    </xen:if></title>
For some reason, is not working. Can you please let me know what is the proper format?
 
The problem is, the first condition will always be true. {$title} is usually available on every page. I'm guessing the title is always:
Code:
{xen:raw $title} | {$xenOptions.boardTitle}
?

You probably need to change the entire conditional to:

HTML:
<title>
    <xen:if is="{$contentTemplate} == 'forum_list'">
        {$xenOptions.boardTitle} {xen:phrase forums}
    <xen:elseif is="{$contentTemplate} == 'resource_index'" />
        {$xenOptions.boardTitle} {xen:phrase resources}
    <xen:elseif is="{$title}" />
        {xen:raw $title} | {$xenOptions.boardTitle}
    <xen:else />
        {$xenOptions.boardTitle}
    </xen:if>
</title>
 
The problem is, the first condition will always be true. {$title} is usually available on every page. I'm guessing the title is always:
Code:
{xen:raw $title} | {$xenOptions.boardTitle}
?[/html]
Ya it does, sorry I was not paying attention.
However, on live site (1.3.0) the title is displayed properly with the above mentioned conditional?
https://www.axivo.com/

On my vanilla test forum running on 1.3.1 it does not.
 
Last edited:
That's pretty much impossible unless you have changed something else.

{$title} comes from the value set in the <xen:title /> tags you see in pretty much every template. That's what I mean by that condition will always be true because pretty much every single template includes <xen:title> and that's what feeds the {$title} conditional in the template.
 
Ya, I understand your logic. :)
I'll change it as you suggested, thanks Chris. Honestly I don't remember editing anything related to code and on templates nothing is changed.
 
hmmm for me <xen:if is="{$contentTemplate} == 'forum_list'"> does not seem to work in page_container. I'm trying to add something to titles and h1 when viewing a forum_list page but it's not working.

For example
<title><xen:if is="{$title}">{xen:raw $title} <xen:if is="{$contentTemplate} == 'forum_list'">Forum</xen:if>| Physics Forums<xen:else />{$xenOptions.boardTitle}</xen:if></title>
 
Last edited:
Back
Top Bottom