Default sidebar code help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MrHorror
    Senior Member
    • Nov 2010
    • 176

    [Forum] Default sidebar code help

    Hi. I currently have a sidebar code where I can make the dvb4 default sidebar appear on what style I want it to appear on. Instead of it appearing on all styles. The code is this:
    Code:
    if ($style['styleid'] != 14) $show['sidebar'] = false;
    . I currently have it set to appear only with the default vb4 style. But I want to use it on 3 of my 8 styles. So I learned I'd have to add in_array to the code. Which would look like this?

    Code:
    if (in_array($style['styleid'] array(14.16) $show['sidebar'] = false;
    I tested this ^....and it didn't work. So if someone could clean this code up for me or arrange it properly so I get the desired effect?
  • Lynne
    Former vBulletin Support
    • Oct 2004
    • 26255

    #2
    You are missing two ) (your parenthesis need to add up) and you need a comma in your array, not a period, and you in_array needs a comma to separate the two parameters.
    Code:
    [COLOR=#333333]if (in_array($style['styleid'], array(14,16))) $show['sidebar'] = false;[/COLOR]

    Please don't PM or VM me for support - I only help out in the threads.
    vBulletin Manual & vBulletin 4.0 Code Documentation (API)
    Want help modifying your vbulletin forum? Head on over to vbulletin.org
    If I post CSS and you don't know where it goes, throw it into the additional.css template.

    W3Schools <- awesome site for html/css help

    Comment

    • MrHorror
      Senior Member
      • Nov 2010
      • 176

      #3
      Ok I tried that variation and it didn't work either.

      Comment

      • Lynne
        Former vBulletin Support
        • Oct 2004
        • 26255

        #4
        I can't even get the original that you posted to work on my vb4.2.0 forum. What hook are you using?

        Please don't PM or VM me for support - I only help out in the threads.
        vBulletin Manual & vBulletin 4.0 Code Documentation (API)
        Want help modifying your vbulletin forum? Head on over to vbulletin.org
        If I post CSS and you don't know where it goes, throw it into the additional.css template.

        W3Schools <- awesome site for html/css help

        Comment

        • MrHorror
          Senior Member
          • Nov 2010
          • 176

          #5
          This is what I am using currently on my board.

          if (
          $style['styleid'] != x) $show['sidebar'] = false;

          Template hook is forumhome_complete

          Comment

          • Lynne
            Former vBulletin Support
            • Oct 2004
            • 26255

            #6
            I just used this on my site and the result was no sidebar for styleids 2 and 8. So it worked fine for me.

            PHP Code:
            if (in_array($style['styleid'], array(2,8))) $show['sidebar'] = false

            Please don't PM or VM me for support - I only help out in the threads.
            vBulletin Manual & vBulletin 4.0 Code Documentation (API)
            Want help modifying your vbulletin forum? Head on over to vbulletin.org
            If I post CSS and you don't know where it goes, throw it into the additional.css template.

            W3Schools <- awesome site for html/css help

            Comment

            • MrHorror
              Senior Member
              • Nov 2010
              • 176

              #7
              That's weird. On my board, when I used the first variation of the code you gave me? Adding a style ID allows the sidebar to show up on the styles that I DO want it to show up on. So the one with array added now deletes the sidebar from the styles that you DON'T want it to show up on. Weird.

              Comment

              • Lynne
                Former vBulletin Support
                • Oct 2004
                • 26255

                #8
                Well, you can add a ! in there to do the reverse. This would make it so any style except 2 and 8 would not have the sidebar:

                PHP Code:
                if (!in_array($style['styleid'], array(2,8))) $show['sidebar'] = false

                Please don't PM or VM me for support - I only help out in the threads.
                vBulletin Manual & vBulletin 4.0 Code Documentation (API)
                Want help modifying your vbulletin forum? Head on over to vbulletin.org
                If I post CSS and you don't know where it goes, throw it into the additional.css template.

                W3Schools <- awesome site for html/css help

                Comment

                widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                Working...
                😀
                😂
                🥰
                😘
                🤢
                😎
                😞
                😡
                👍
                👎