1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.3 $contentTemplate conditional?

Discussion in 'Styling and Customization Questions' started by Floren, Apr 13, 2014.

  1. Floren

    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?
     
  2. Chris D

    Chris D XenForo Developer Staff Member

    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>
     
  3. Floren

    Floren Well-Known Member

    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: Apr 13, 2014
  4. Chris D

    Chris D XenForo Developer Staff Member

    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.
     
  5. Floren

    Floren Well-Known Member

    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.
     

Share This Page