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

XF 1.4 Display content differently on forum_list vs. forum_view

Discussion in 'Styling and Customization Questions' started by NURV, Mar 13, 2015.

  1. NURV

    NURV Member

    Hi, how can I display content from a template differently when loaded through the forum_list template than when loaded through the forum_view template? I am trying to display a slightly different node_forum_level_2 template for the homepage vs. the forum view page. I have tried the following code with no luck. In fact, nothing shows at all:

    <xen:if is="{$contentTemplate} == 'forum_list'">
    Display content version 1
    </xen:elseif />
    Display content version 2
    Neither one displays anything.

    According to Brogan's conditional guide, including how to find the correct template names, this should work.

    Via: https://xenforo.com/community/resources/conditional-statements.1604/

    Help would be greatly appreciated.
  2. Brogan

    Brogan XenForo Moderator Staff Member

    Ensure the variable is available in the template you are running the code.

    You can check that by dumping it like so: {xen:helper dump, $variable}

    Also, your else should just be <xen:else />.
  3. NURV

    NURV Member

    I typod the else tag. Sorry about that. Didn't work with that fixed either.

    I tried the variable check you recommended and it returned "NULL".

    So how then can I achieve what I'm aiming for? Basically, I want to display a different node_forum_level_2 template on the homepage than is displayed on the forum pages. Right now they both use the same template, so I tried to put the condition in that template. If I can create a new template and somehow use that instead for the subforum listings within a forum view page, that would work too. Is this possible, and if so, what is the best way to do it?
  4. Brogan

    Brogan XenForo Moderator Staff Member

    If it's simple changes it could be done with CSS and specificity.

    For structural changes though, having different template code is likely easier.
  5. NURV

    NURV Member

    Yes it's more than just CSS stuff. How can I specify to use a different template for each? If that works then that would be perfect for me.
  6. NURV

    NURV Member

    Does anybody know if this is possible? Sorry for the double post. Just anxious to get this up and running and I need to achieve this functionality in order to do so.

Share This Page