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

How Do You Use A Custom Userfield for Subheading and Selected Tab?

Discussion in 'Styling and Customization Questions' started by DRE, Feb 28, 2012.

  1. DRE

    DRE Well-Known Member

    I know how to create a customer user field but how do I add html color code b60000 one time only to the following 3 sections?

    Style Properties/Building Blocks/Subheading/Background
    Style Properties/Header and Navigation/Selected Tab/Background
    Style Properties/Selected Tab Link/Hover State/Background

    Selected Tab Background can be found in navigation.css

    but I can't find the other two.

    I know how to put them in an if condition but I don't know how to wrap them so that they show in the 3 areas above.

    Code:
    <xen:if is="{$visitor.customFields.background3}"> style="background: #{$visitor.customFields.background3};"</xen:if>
     
  2. IFeelYourPain13

    IFeelYourPain13 Active Member

    Support is done only by the thread, in case others have similar questions.
     
  3. DRE

    DRE Well-Known Member

    i couldnt find the thread. k hold on
     
  4. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    CSS can't be made conditional, but class names can. So in your HTML templates you would use code like this to conditionally name classes:

    Code:
    <div class="<xen:if is="{$visitor.customFields.backgroundclass}">{$visitor.customFields.backgroundclass}</xen:if>">
    
    </div>
    
    Then define that class in EXTRA.css.
     
  5. DRE

    DRE Well-Known Member

    So basically, I have to come up with a list of colors I'd want to use for the custom user field backgroundclass? For example, I create a Drop Down Selection User Field and have the following options:

    Value: 3red
    Title: Red
    Value: 3blue
    Title: Blue

    The drop down box would show Red and Blue. The value is the name of the class defined in EXTRA.css right?

    For example:

    EXTRA.css
    Code:
    .3red
    {
    background-color: red;
    }
    .3blue
    {
    background-color: blue;
    }
     
  6. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    Correct.
     
  7. DRE

    DRE Well-Known Member

    Not working. Hmm.
     
  8. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    First make sure the class name is showing in the page source. If that is correct then load the style sheet and make sure the class definitions are there. If that is correct then it's probably a problem with your CSS.
     
  9. DRE

    DRE Well-Known Member

    Yeah I think there's a problem with my css.
     
  10. DRE

    DRE Well-Known Member

    I see the class definition in page source but not css.
     
  11. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    It should be in the stylesheet (css.php).
     
  12. DRE

    DRE Well-Known Member

    It works. I was missing a zero.
     
  13. DRE

    DRE Well-Known Member

    K Finally got it working. Now I just have to find where to put it.
     
  14. DRE

    DRE Well-Known Member

    Can a custom userfield go inside extra.css?
     
  15. DRE

    DRE Well-Known Member

    BTW I do see a conditional inside a CSS. I saw it in Anthony Parson's userbar addon.

    I just need to put a custom userfield inside one.

    For example:

    Code:
    /* Shift Visitor Links to Moderator Bar */
     
    <xen:if is="@xfofUserbar">
    #moderatorBar .adminLink
    {
        float:left !important;
    }
    </xen:if>
    @xfofUserbar is a custom style property.

    How do I make a custom user style property with custom userfields?
     
  16. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

    That's a style property which is different. A style property doesn't change for each user. It's consistent across the forum.
     
  17. DRE

    DRE Well-Known Member

    kayyy
     

Share This Page