Announcement

Collapse
No announcement yet.

help with <if condition>

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

  • help with <if condition>

    Hi folks,

    I've set up a German (and other sections) for our non-English speaking viewers. At the bottom of every page (in place of the forumrules) I've placed a google-translate pulldown menu.

    I'm struggling to get it to recognise different forums.

    For example, I'd like all forums (except those within the conditional statement) to offer 'translate from English' but for the German forum (as an example) to offer 'translate from German' and the French forum to offer 'translate from French'.

    What I have is:

    HTML Code:
    <if condition="in_array($forum[forumid], array(123))"> 
    <!--  German translation tool -->
    </if>
    <if condition="in_array($forum[forumid], array(456))"> 
    <!-- French translation tool -->
    </if>
    <if condition="in_array($forum[forumid], array(789))"> 
    <!-- Spanish translation tool -->
    </if>
    
    <if condition="!in_array($forum[forumid], array(123) or $forum[forumid], array(456) or $forum[forumid], array(789))"> 
    <!-- English translation -->
    </if>
    Yet it doesn't seem to function. Any ideas folks?
    Now as I understand it, the functions should check the forum ID and assuming it isn't 123,456 or 789 it should instead run the English translation tool, right?


    Note: I am not a coder by any standard, just a guy trying to figure out the basics.
    VB 5.4.1 - PHP 7..2.4 - MySQL 5.5.56
    No Addons - none at all.

  • #2
    <if condition="!in_array($forum[forumid], array(123,456,789))">

    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 &lt;- awesome site for html/css help

    Comment


    • #3
      Thanks, but this doesn't seem to be helping

      Here's the full code I'm using currently (perhaps it may shed some light on the issues?)

      Code:
      <table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="210">
      <thead>
      <tr>
          <td class="thead">
      Anti Misandry Tools
          </td>
      </tr>
      </thead>
      <tbody id="collapseobj_forumrules" style="$vbcollapse[collapseobj_forumrules]">
      <tr>
          <td class="alt1" nowrap="nowrap">
      <if condition="!in_array($forum[forumid], array(38,103))">
      <!-- 38 = other languages (general) / 103 = German -->
              <div class="smallfont">Translate from English...
                  <script src="http://www.gmodules.com/ig/ifr?url=http://www.google.com/ig/modules/translatemypage.xml&up_source_language=en&w=160&h=60&title=&border=&output=js"></script>
              <hr />
              </div>
      </if>
      
      <if condition="in_array($forum[forumid], array(103))">
      <!--  103 = German -->
              <div class="smallfont">This will soon be 'Translate From German to xyz' tool
      
              <hr />
              </div>
      </if>
          </td>
      </tr>
      </tbody>
      </table>
      But when I visit the German forum (103) or the 'other languages' forum (38) they still show the translate from English version...

      I recently purchased vBSEO, could that be interferring?
      VB 5.4.1 - PHP 7..2.4 - MySQL 5.5.56
      No Addons - none at all.

      Comment


      • #4
        Which template are you putting this in? You may need to try a different variable depending: $forum[forumid], $foruminfo[forumid], $forumid, $thread[forumid], $threadinfo[forumid]

        Try each of those and see if it works.

        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 &lt;- awesome site for html/css help

        Comment


        • #5
          Originally posted by Lynne View Post
          Which template are you putting this in?
          I've cleared out the original forumrules template and used that, so it should be included with every thread page.

          Originally posted by Lynne View Post
          You may need to try a different variable depending: $forum[forumid], $foruminfo[forumid], $forumid, $thread[forumid], $threadinfo[forumid]

          Try each of those and see if it works.
          I'll have a crack at it tomorrow, as I'm getting a headache

          Thanks for the tips, Lynne.
          VB 5.4.1 - PHP 7..2.4 - MySQL 5.5.56
          No Addons - none at all.

          Comment


          • #6
            $foruminfo[forumid] appears to have resolved this issue... what's the difference?

            And most importantly, THANKS!!!
            VB 5.4.1 - PHP 7..2.4 - MySQL 5.5.56
            No Addons - none at all.

            Comment


            • #7
              Originally posted by karlm View Post
              $foruminfo[forumid] appears to have resolved this issue... what's the difference?

              And most importantly, THANKS!!!
              If I knew the exact difference, I would have been able to tell you right away which to use! I have just found through trial and error that sometimes one works, and at other times, another works. Someone who is a real coder (not a trial and error type coder like I am) might know the difference, but unfortunately I do not.

              But, I'm glad you got it working!

              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 &lt;- awesome site for html/css help

              Comment

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