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

XF 1.1 Custom Background member_view?

Discussion in 'XenForo Questions and Support' started by nguyenhuuhung, Dec 26, 2013.

  1. nguyenhuuhung

    nguyenhuuhung Active Member

  2. Jeremy

    Jeremy XenForo Moderator Staff Member

    Add the content template conditional from @Brogan's conditional guide with that thread.
     
  3. nguyenhuuhung

    nguyenhuuhung Active Member

    I tried verry much.But,it didn't work.I Only want to apply with member_view template
     
  4. Jeremy

    Jeremy XenForo Moderator Staff Member

    As per Brogan's guide:

    How can I show content on a specific page?
    <xen:if is="{$contentTemplate} == 'xyz'">
    This content will show on the xyz template
    </xen:if>
     
    nguyenhuuhung likes this.
  5. nguyenhuuhung

    nguyenhuuhung Active Member

    @Jeremy
    I Create a custom field "background"
    In PAGE_CONTAINER, i find:
    Code:
    <div id="content" class="{$contentTemplate}">
    
    Replace:
    Code:
    <div id="content"<xen:if is="{$visitor.customFields.largebackground} == 'yes'"><xen:if is="{$visitor.customFields.background}"> style="background-image: url({$visitor.customFields.background});background-position: center;background-attachment:fixed;"</xen:if><xen:else /><xen:if is="{$visitor.customFields.background}"> style="background-image: url(http://vietnamairline.edu.vn/wp-content/uploads/2013/02/co-cay.jpg);"</xen:if></xen:if> class="{$contentTemplate}">
    In code this.
    Link : http://vietnamairline.edu.vn/wp-content/uploads/2013/02/co-cay.jpg
    It is default background.


    But, i didn't work.!
     
  6. nguyenhuuhung

    nguyenhuuhung Active Member

  7. Russ

    Russ Well-Known Member

    I don't have time to give exact steps right now... but I would suggest looking at this tutorial:

    http://xenforo.com/community/resour...ge-based-on-user-profile-field-selection.535/


    Instead of placing the image in the member view profile page, you can possibly use some custom CSS with a conditional, something like this:

    Code:
    <xen:if is="{$contentTemplate} == 'member_view'">
    <xen:if is="{$user.customFields.testfield}">
    html { background: url(@imagePath/xenforo/custombg/{$user.customFields.testfield}.jpg) no-repeat top center #000 !important; }
    </xen:if>
    </xen:if>
    It's early in the morning with no coffee so this might not work but :D, the conditional checks to see if you're in the member view page(I think)

    The conditional checks to see if the user you're viewing has a custom field set then applies a background. If the user doesn't have a custom field set the html css shouldn't load therefore the default background would load.

    I hope this works for you :D


     
    dwdmadmac and nguyenhuuhung like this.

Share This Page