Announcement

Collapse
No announcement yet.

Need information on (foruminfo[forumid])

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

  • Need information on (foruminfo[forumid])

    Hi,

    I wrote a very simple plugin for myself in 3.5 which looked at the forum id. If the forum id matched what was in the script, a certain value was assigned to a variable. If not, it would just give the variable a random value.

    Since I upgraded to 3.6 this hasnt been working - im on 3.6.2 now. It always displays a random value, no matter what board im on.

    Would someone be able to tell me if $foruminfo[forumid] is no longer a valid VB variable/array? and if not, whats the new way of finding out the forum id?

    Here's what I have:
    Code:
    //trader banner
    if($foruminfo[forumid] == "88") {
    $traderbanner = "aat.jpg";
    } else {
    //default banner
    $traderbanner = "default.jpg";
    }



    Thanks in advance,

  • #2
    What hook location? What template references that variable?

    Comment


    • #3
      Originally posted by Jake Bunce View Post
      What hook location? What template references that variable?
      global_start

      and its referenced in "navbar" template. So it appears just below the navbar, and before the forum boards.

      Comment


      • #4
        This bit of code is at the bottom of the navbar template. I know this bit works because it does display banners.
        Code:
        <!-- MY TRADER BANNER ROTATOR -->
        <if condition="$traderbanner">
        <table width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td valign="top" bgcolor="#990000"><table width="100%"  border="0" cellspacing="1" cellpadding="3">
                <tr> 
                  <td align="center" valign="top" bgcolor="#FFFFFF"><img src="/graphics/traders/$traderbanner"></td>
                </tr>
              </table></td>
          </tr>
        </table>
        <br>     
        </if>
        <!-- END MY TRADER BANNER ROTATOR -->

        And this is the plugin within "global_start". It used to live in header_include until 3.5 but then I got told anything in header_include needed to be moved to "global_start" to work in 3.5 , so thats why I put it there.

        Code:
        //tints
        if($foruminfo[forumid] == "88") {
        $traderbanner = "aat.jpg";
        }
        //good motoring
        elseif($foruminfo[forumid] == "161") {
        $traderbanner = "goodmotoring.jpg";
        }
        //ELSE ROTATE THE TRADERS BANNER ON EVERY PAGE
        else {
            //general images
        $tradersdirectory = "/<!-PATH REMOVED FROM POST->/graphics/traders/";
            
            //if there are files
            if (file_exists($tradersdirectory)) {
          
            //then count number of files
            if(count(glob("{$tradersdirectory}*.jpg")) != "0") {
                //then do some fancy bits to randomise which image is outputed
                $ranget = count(glob("{$tradersdirectory}*.jpg"));
                $filest = array();
                $timest = array();
                $handlet = opendir($tradersdirectory);
                
                while(($itemt = readdir($handlet)) !== FALSE) {
                               if(( $itemt != '.' ) 
                                 && ( $itemt != '..' ) 
                                 && ( $itemt != 'Thumbs.db' ) 
                                 && is_file( "$tradersdirectory/$itemt" )) {
                                     $filest[] = $itemt;
                                     $timest[] = filemtime( "$tradersdirectory/$itemt" );
                                 }
                  }
            $randomt = array_rand($filest, $ranget);
            $traderbanner = $filest[$randomt[0]];
            }
        }
        //  IF NO IMAGES WERE FOUND IN DIRECTORY - DISPLAY THIS IMAGE
        else
        {
        $traderbanner = "noadvert.jpg";
        }
         
        }
        Last edited by zemic; Wed 11 Oct '06, 3:23pm.

        Comment


        • #5
          Use $forumid instead of $foruminfo[forumid].

          Comment


          • #6
            Didnt work im afraid . It still rotates random images, but doesnt pick up that im on a certain board so should show a certain banner. Going to bed now. Ill have another look at it tomorrow . Thanks for ur help so far..

            Comment


            • #7
              Try some debug code to capture and check the output of the variables you are using. It is just code troubleshooting at this point.

              Comment

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