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

XF 1.3 Node Style Options

Discussion in 'Styling and Customization Questions' started by Zanthor, Mar 20, 2014.

  1. Zanthor

    Zanthor Member

    I have two Styles on my site, a fixed width of 1200px and a fluid layout.

    On several of my nodes I have forced a style to remove components I don't want. (Sample) Is there a way from within a style to detect the users selected style? Then I could add this to the width control of the forced style:

    <xen:if {style = 'static'}>
    max-width: 1000px;
    margin: 0 auto;
    box-sizing: border-box;
  2. Amaury

    Amaury Well-Known Member

    I think you'll need an add-on to detect a style a user is using.
  3. Brogan

    Brogan XenForo Moderator Staff Member

    I'm not sure I understand what it is you are trying to do.

    There is no need to detect which style the visitor is using; just add the CSS to EXTRA.css for each style.
    Amaury likes this.
  4. Zanthor

    Zanthor Member

    Style1: Fixed Max Width, User Selectable, Default
    ---Style2: Fluid, User Selectable
    ---Style3: Fixed (Currently), NON User Selectable

    Style 3 is utilized for specific nodes. For these nodes I have stripped out much of the 'forum' type content, things like # of posts, RSS links, etc. It is statically set on the nodes with the Force Style option.

    Thus if a user visits the site they see a fixed width site. If they view those nodes, they are also a fixed width. If a user registers and changes to the Fluid site, the site is fluid, but those nodes are still a fixed width. I'm trying to make those nodes respect the users width choices.

    I've modified the public.css as follows:
        @property "pageWidth";
        padding-right: 5px;
        padding-left: 5px;
        margin: 0 auto;
        @property "/pageWidth";
        <xen:if is="{$visitor.style_id} == 8">
            max-width: 1200px;
            margin: 0 auto;
            box-sizing: border-box;
    However it doesn't appear that the $visitor.style_id variable is in scope when this is processed as it doesn't evaluate True. The same code just dropped into a custom page template does work.
  5. Brogan

    Brogan XenForo Moderator Staff Member

    OK, that gives a better picture of what it is you're doing.

    That conditional statement isn't available in the CSS templates however.
    You might be able to do it by editing the templates directly and adding a class using that though.
  6. Zanthor

    Zanthor Member

    This requires modifying 5 templates but works perfectly! In case anyone else is trying to do this...
    • search_bar
    • moderator_bar
    • logo_block
    • navigation
    Added the if block:
    <div class="pageWidth {xen:if '{$visitor.style_id} == 8', 'ikesWidth'}">
    And added the CSS to EXTRA.css

Share This Page