Different image logo for each forum ID. Which code?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Cercle
    New Member
    • Apr 2007
    • 23
    • 3.6.x

    [Answered] Different image logo for each forum ID. Which code?

    Hi coders.

    Anyone knows the correct Header template code to place a different image logo for each forum ID?

    I´ve found this thread, paste the red code at the end of the header template but don´t works. I get the error:

    The following error occurred when attempting to evaluate this template:
    %1$s
    This is likely caused by a malformed conditional statement. It is highly recommended that you fix this error before continuing, but you may continue as-is if you wish.



    Thank you in advance.
  • Final Kaoss
    Senior Member
    • Nov 2006
    • 581

    #2
    Works for me.

    Comment

    • Eve_Ra
      Senior Member
      • Nov 2007
      • 124
      • 4.2.X

      #3
      It's a code for vB 3.8. vB 4.x conditions are different now.
      Miaouuuu... Ne me caressez pas à rebrousse-poils, ça fait de l'électricité !

      Comment

      • Cercle
        New Member
        • Apr 2007
        • 23
        • 3.6.x

        #4
        Which is the correct code for Vb4 please?

        Thank you.

        Comment

        • Trevor Hannant
          vBulletin Support
          • Aug 2002
          • 24358
          • 5.7.X

          #5
          Please see here for a list of vB4 conditionals:

          Vote for:

          - Admin Settable Paid Subscription Reminder Timeframe (vB6)
          - Add Admin ability to auto-subscribe users to specific channel(s) (vB6)

          Comment

          • Cercle
            New Member
            • Apr 2007
            • 23
            • 3.6.x

            #6
            Thanks for the link.

            Is this code? And where must I paste it exactly?:


            <vb:if condition="$forum[forumid] == x">Show this if forum id is x</vb:if>

            Comment

            • Trevor Hannant
              vBulletin Support
              • Aug 2002
              • 24358
              • 5.7.X

              #7
              Follow the guide in the link you posted above and just use the new conditional statement, i.e.:

              <vb:if condition="$forum[forumid] == x"> instead of <if condition="$foruminfo[forumid] == X">

              and:

              </vb:if> instead of </if>
              Vote for:

              - Admin Settable Paid Subscription Reminder Timeframe (vB6)
              - Add Admin ability to auto-subscribe users to specific channel(s) (vB6)

              Comment

              • Cercle
                New Member
                • Apr 2007
                • 23
                • 3.6.x

                #8
                Originally posted by Trevor Hannant
                Follow the guide in the link you posted above and just use the new conditional statement, i.e.:

                <vb:if condition="$forum[forumid] == x"> instead of <if condition="$foruminfo[forumid] == X">

                and:

                </vb:if> instead of </if>
                Thanks Trevor

                The problem is that the code is different in my Vb4.

                I can´t find the code of the guide in my header template :

                <!-- logo --> <a name="top"></a> <table border="0" width="$stylevar[outertablewidth]" cellpadding="0" cellspacing="0" align="center"> <tr>



                What I´m doing wrong?

                All the best.

                Comment

                • Matthew Gordon
                  Senior Member
                  • May 2002
                  • 3243
                  • 1.1.x

                  #9
                  In the header template, replace this:
                  Code:
                  <img src="{vb:stylevar titleimage}" alt="{vb:rawphrase x_powered_by_vbulletin, {vb:raw vboptions.bbtitle}}" />
                  with this:
                  Code:
                  <vb:if condition="$GLOBALS['foruminfo']['forumid'] == [color=blue]1[/color]">
                  	<img src="[color=blue]images/misc/vbulletin2_logo.gif[/color]" alt="{vb:rawphrase x_powered_by_vbulletin, {vb:raw vboptions.bbtitle}}" />
                  <vb:elseif condition="$GLOBALS['foruminfo']['forumid'] == [color=green]2[/color]" />
                  	<img src="[color=green]images/misc/vbulletin3_logo_white.gif[/color]" alt="{vb:rawphrase x_powered_by_vbulletin, {vb:raw vboptions.bbtitle}}" />
                  <vb:else />
                  	<img src="{vb:stylevar titleimage}" alt="{vb:rawphrase x_powered_by_vbulletin, {vb:raw vboptions.bbtitle}}" />
                  </vb:if>
                  Change the colored numbers to the forumids of the forums in question, change the image paths to the images you want to use. If you need to add a third forum to the mix, copy the middle "elseif" section like so:
                  Code:
                  <vb:if condition="$GLOBALS['foruminfo']['forumid'] == [color=blue]1[/color]">
                  	<img src="[color=blue]images/misc/vbulletin2_logo.gif[/color]" alt="{vb:rawphrase x_powered_by_vbulletin, {vb:raw vboptions.bbtitle}}" />
                  <vb:elseif condition="$GLOBALS['foruminfo']['forumid'] == [color=green]2[/color]" />
                  	<img src="[color=green]images/misc/vbulletin3_logo_white.gif[/color]" alt="{vb:rawphrase x_powered_by_vbulletin, {vb:raw vboptions.bbtitle}}" />
                  <vb:elseif condition="$GLOBALS['foruminfo']['forumid'] == [color=red]3[/color]" />
                  	<img src="[color=red]images/misc/vbulletin3_logo_grey.gif[/color]" alt="{vb:rawphrase x_powered_by_vbulletin, {vb:raw vboptions.bbtitle}}" />
                  <vb:else />
                  	<img src="{vb:stylevar titleimage}" alt="{vb:rawphrase x_powered_by_vbulletin, {vb:raw vboptions.bbtitle}}" />
                  </vb:if>
                  Last edited by Matthew Gordon; Mon 25 Jun '12, 5:36pm. Reason: Just adding whitespace.

                  Comment

                  • Andy
                    Senior Member
                    • Jan 2002
                    • 5886
                    • 4.1.x

                    #10
                    I've never liked using the hard to read elseif conditionals. Here how I do it:

                    Code:
                    <vb:if condition="$foruminfo['forumid'] == 1">
                    add content here
                    </vb:if>
                    
                    <vb:if condition="$foruminfo['forumid'] == 2">
                    add content here
                    </vb:if>
                    
                    <vb:if condition="$foruminfo['forumid'] == 3">
                    add content here
                    </vb:if>
                    
                    <vb:if condition="$foruminfo['forumid'] == 4">
                    add content here
                    </vb:if>

                    Comment

                    • Eve_Ra
                      Senior Member
                      • Nov 2007
                      • 124
                      • 4.2.X

                      #11
                      It's more readable, yes, but there is no image for when you are on forumhome. The Matthew code is better : there is an image for when you are in forumid=1, an image when you are in forumid=2, an image when you are in forumid=3.... and an image for when you are elsewhere, as forumhome or other forums than 1, 2 or 3.
                      Miaouuuu... Ne me caressez pas à rebrousse-poils, ça fait de l'électricité !

                      Comment

                      • Andy
                        Senior Member
                        • Jan 2002
                        • 5886
                        • 4.1.x

                        #12
                        Good point Eve_Ra.

                        To add a conditional for all other times I would add:

                        Code:
                        <vb:if condition="$foruminfo['forumid'] == ''">
                        add content here
                        </vb:if>

                        Comment

                        • Eve_Ra
                          Senior Member
                          • Nov 2007
                          • 124
                          • 4.2.X

                          #13
                          For other forums, it's ok, but not for forumhome ! there is no forumid for forumhome.
                          Miaouuuu... Ne me caressez pas à rebrousse-poils, ça fait de l'électricité !

                          Comment

                          • Andy
                            Senior Member
                            • Jan 2002
                            • 5886
                            • 4.1.x

                            #14
                            Originally posted by Eve_Ra
                            For other forums, it's ok, but not for forumhome ! there is no forumid for forumhome.
                            Yes so it would display the default logo set by that last conditional.

                            Comment

                            • Matthew Gordon
                              Senior Member
                              • May 2002
                              • 3243
                              • 1.1.x

                              #15
                              Originally posted by Andy
                              Good point Eve_Ra.

                              To add a conditional for all other times I would add:

                              Code:
                              <vb:if condition="$foruminfo['forumid'] == ''">
                              add content here
                              </vb:if>
                              Wouldn't work for any forum that you don't have specifically listed in the above conditionals. The original vB3 thread used a !in_array with a list of all the used forumids - that would work here, but it's just simpler to use elseifs now that they are available. If you really want it easier to read, add some more whitespace where necessary. Also, you have to use $GLOBALS['foruminfo'] instead of $foruminfo since $foruminfo is not registered with the header template.

                              Comment

                              widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                              Working...