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

Conditional for if viewing homepage

Discussion in 'XenForo Development Discussions' started by Trombones13, Dec 11, 2010.

  1. Trombones13

    Trombones13 Well-Known Member

    I'd like to have a block on my sidebar only show on the homepage--right now it's showing on other sidebars such as the Conversations page. How can I do this with a xen:if conditional? Thanks in advance. :)
  2. Shadab

    Shadab Well-Known Member

    Make sure you put it inside the <xen:sidebar> ... </xen:sidebar> tags in "forum_list" template.
    No conditionals needed.
    Trombones13 likes this.
  3. Trombones13

    Trombones13 Well-Known Member

    Ah; OK. :) So, what if I wanted to put one somewhere that wasn't at the bottom of all the blocks, such as in the discussion happening here?
  4. Shadab

    Shadab Well-Known Member

    Only positions #1 (above staff online), #3 (above statistics) and #4 (below statistics) are possible if you are placing your content via the "forum_list" template. The text you would look out for, in that template, is:

    #1 - Above <xen:include template="sidebar_online_users" />
    #3 - Above <!-- block: forum_stats -->
    #4 - Below <!-- block: forum_stats -->
    Trombones13 likes this.
  5. Trombones13

    Trombones13 Well-Known Member

    Awesome; thanks a lot! So, are these correct now?
    1. Below the Visitor Panel (your name, messages, likes, and points):
    Template: forum_list
    Add above: <xen:include template="sidebar_online_users" />

    2. Below "Staff Online Now:"
    Template: sidebar_online_users
    Add above: <!-- block: sidebar_online_users -->

    3. Below "Members Online Now:"
    Template: forum_list
    Add above: <!-- block: forum_stats -->

    4. Below "Forum Statistics:"
    Template: forum_list
    Add below: <!-- end block: forum_stats -->

    5. Below all other sidebar blocks (in this instance, TaigaChat):
    Template: PAGE_CONTAINER
    Add below: <!-- end block: forum_stats --> and any other <xen:include template lines
  6. Shadab

    Shadab Well-Known Member

    Looks okay. Haven't tested each one, though. :D
  7. Trombones13

    Trombones13 Well-Known Member

    I just tested them, but I wanted to make sure I didn't mix any of them up, lol. Since they appear OK to you, I'll assume they are. Thanks a lot for your help! :D
    Shadab likes this.
  8. Umit

    Umit Active Member

    Hi, how can i show ads for only homepage? (i want to put my ad code to footer template)
    <xen:if is="{$XXhomeXX}">my ad code</div> 
  9. Floris

    Floris Guest

    Umit likes this.
  10. Umit

    Umit Active Member

    Floris likes this.

Share This Page