Announcement

Collapse
No announcement yet.

Forum and background image VB3

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Forum and background image VB3

    Hello,

    I'm writing to you because I have some problems to modify Template: forumhome_forumbit_level1_nopost in vb3.

    We have 4 main categories on our forum : life, earth, univers and technologies.

    We'd like to set a different background for each forum with an image like bg.gif in the Template: forumhome_forumbit_level1_nopost :

    <tbody>
    <tr>
    <td background="images/bg.gif" class="tcat" colspan="<if condition="$vboptions[showmoderatorcolumn]">6<else />5</if>">
    <a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('forumbit_$forumid')"><img id="collapseimg_forumbit_$forumid" src="$stylevar[imgdir_button]/collapse_tcat{$collapseimg_forumid}.gif" alt="" border="0" /></a>
    <a href="forumdisplay.php?$session[sessionurl]f=$forum[forumid]">TEST $forum[title]</a>
    <if condition="$show['forumdescription']"><div class="smallfont">$forum[description]</div></if>
    <if condition="$show['subforums']"><div class="smallfont"><strong>$vbphrase[subforums]</strong>: $forum[subforums]</div></if>
    </td>
    </tr>
    </tbody>
    <if condition="$childforumbits">
    <tbody id="collapseobj_forumbit_$forumid" style="{$collapseobj_forumid}">
    $childforumbits
    </tbody>
    </if>


    I don't know how I could modify this part of the template.

    I'd like to program :

    if forumid=1 <td background="images/bg1.gif" class="tcat" colspan ...
    if forumid=2 <td background="images/bg2.gif" class="tcat" colspan ...

    Thank you for your help,

    Guillaume

  • #2
    I think this post by me clears things up

    http://www.vbulletin.com/forum/showthread.php?t=95556

    Yes, you can use a conditional to control those images.

    Comment


    • #3
      thank u ! how quick you are !


      I've tried

      <if condition="($forumid == 1)">
      <tbody>
      <tr>
      <td background="images/bg.gif" class="tcat" colspan="<if condition="$vboptions[showmoderatorcolumn]">6<else />5</if>">
      <a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('forumbit_$forumid')"><img id="collapseimg_forumbit_$forumid" src="$stylevar[imgdir_button]/collapse_tcat{$collapseimg_forumid}.gif" alt="" border="0" /></a>
      <a href="forumdisplay.php?$session[sessionurl]f=$forum[forumid]">TEST $forum[title]</a>
      <if condition="$show['forumdescription']"><div class="smallfont">$forum[description]</div></if>
      <if condition="$show['subforums']"><div class="smallfont"><strong>$vbphrase[subforums]</strong>: $forum[subforums]</div></if>
      </td>
      </tr>
      </tbody>
      <if condition="$childforumbits">
      <tbody id="collapseobj_forumbit_$forumid" style="{$collapseobj_forumid}">
      $childforumbits
      </tbody>
      </if>
      <else />
      <tbody>
      <tr>
      <td background="images/bg2.gif" class="tcat" colspan="<if condition="$vboptions[showmoderatorcolumn]">6<else />5</if>">
      <a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('forumbit_$forumid')"><img id="collapseimg_forumbit_$forumid" src="$stylevar[imgdir_button]/collapse_tcat{$collapseimg_forumid}.gif" alt="" border="0" /></a>
      <a href="forumdisplay.php?$session[sessionurl]f=$forum[forumid]">TEST $forum[title]</a>
      <if condition="$show['forumdescription']"><div class="smallfont">$forum[description]</div></if>
      <if condition="$show['subforums']"><div class="smallfont"><strong>$vbphrase[subforums]</strong>: $forum[subforums]</div></if>
      </td>
      </tr>
      </tbody>
      <if condition="$childforumbits">
      <tbody id="collapseobj_forumbit_$forumid" style="{$collapseobj_forumid}">
      $childforumbits
      </tbody>
      </if>

      but i get

      Parse error: parse error, expecting `T_STRING' or `T_VARIABLE' or `T_NUM_STRING' in /home/futurasc/www/admin/upload/includes/functions_forumlist.php(435) : eval()'d code on line 8

      what could I do ?

      thanks a lot !

      Comment


      • #4
        The placement is wrong.
        Just put it in the html code where it is needed.

        like in the source code of the image tag

        <conditional here>
        <img 1>
        <else />
        <img 2>
        </conditional>

        and

        <if condition="($forumid == 1)">
        should probalby be
        <if condition="$forumid == 1">
        if you just have 1.

        Comment


        • #5
          thank you,

          i've done

          <td background="images/bg<if condition="($forumid == 1)"><else />2</if>.gif" class="tcat" colspan="<if condition="$vboptions[showmoderatorcolumn]">6<else />5</if>">

          and it works.

          but how could i do for x forums ?

          could i use elseif ?

          and what is the syntax ?

          I'd like to set x images for x forums !

          PS ! you are so quick !!!

          Comment


          • #6
            For x forums ="($forumid == 1) OR ($forumid == 5)" ..

            elseif? no, you can't use that, you have to nest your conditionals.

            Comment


            • #7
              Originally posted by floris
              For x forums ="($forumid == 1) OR ($forumid == 5)" ..

              elseif? no, you can't use that, you have to nest your conditionals.
              yes but x images for x forums :

              bg1.gif for forum1
              bg2.gif for forum2
              ...

              bgx.gif for forumx

              how could I do more than two ?

              Tks !

              Comment


              • #8
                <if condition="($forumid == 1) OR ($forumid == 5) OR ($forumid == 19)">
                <img border="0" src="img_$forumid.gif" />
                <else />
                normal vbulletin code
                </if>

                Comment


                • #9
                  Yes but with this i can only set 2 images ?

                  one for n forums in the if,

                  and another one with the normal code.

                  How could I do for five different images ?

                  I hope you understand my point

                  sorry

                  Comment


                  • #10
                    I don't think you understand how the conditional works.

                    Let me try to explain.

                    the $forumid.gif makes the image dynamic.
                    So if the forumid is matched in the conditional, the img will try to load the $forumid.gif which is the number.gif for that matched forumid.

                    <if condition is ' forumid = 1 or 2 or 3 or 4 or 5 '>
                    show an image : $forumid.gif
                    <else />
                    show a default image : default.gif
                    </if>

                    The proper syntax would be:

                    <if condition="($forumid == 1) OR ($forumid == 2) OR ($forumid == 3) OR ($forumid == 4) OR ($forumid == 5)">
                    <img border="0" src="$stylevar[imgdir_misc]/img_$forumid.gif" />
                    <else />
                    <img border="0" src="$stylevar[imgdir_misc]/img_default.gif" />
                    </if>

                    If you use that, it will show a numbered img_ 1,2,3,4,5 .gif image if it is either 1,2,3,4, or 5.

                    Since that template knows which forumid it is, it will load img_ $forumid .gif

                    So just name your image img_1.gif for forum 1 and img_2 for forum 2
                    If the forumid is 15, then call it img_15.gif

                    And if you have 1 forum with 3 images, then make img_a_$forumid.gif img_b_$forumid.gif and img_c_$forumid.gif where the $forumid is the number of the forum where it should appear.

                    Comment


                    • #11
                      oh yes ! of course u're right ! I've read too quickly your lines ! In France it's very late and I was fighting to stay awake !

                      thanks a lot for your explanations !

                      all is clear now

                      Comment


                      • #12
                        No problem, it is 01:00 GMT+1 here in the Netherlands right now

                        Comment


                        • #13
                          Floris,

                          You seem to be quite the VB3 gurru. Please help me with my problem located @ http://www.vbulletin.com/forum/showthread.php?t=95515 , I would DEEPLY appreciate it, .

                          Comment


                          • #14
                            I checked, but I am not really experienced yet with the navbar drop downs, etc. So can't really help.

                            Comment

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