Announcement

Collapse
No announcement yet.

Random Logo

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

  • Random Logo

    How do i make a random logo show up each time the page is refreshed? Like this http://www.dfwls1.com/forums

  • #2
    Step 1.
    Create a directory with the logo's and name them
    1.gif, 2.gif, 3.gif, etc.

    Step 2.
    Create a file called logo.php with this content.
    PHP Code:
    <?php
    Header
    ("Content-type: image/gif");
    Header("Cache-Control: no-cache, must-revalidate");
    srand((double)microtime()*1000000);
    $nr rand(18);
    $fn fopen("$nr.gif","r");
    fpassthru($fn);
    ?>
    Replace the 1, 8 <---- with the total number of logo 1.gif, 2.gif .. that you have (if you only have 5, set it 1, 5 - if you got 20, set it 1, 20

    Step 3.
    Modify the header template and replace the img code source with :

    <img src="logo.php" border="0" />

    That should work, check out:

    http://www.vBulletin.nl/files/sig for a demo

    Comment


    • #3
      Thanks ssooo much. It works great!!

      Comment


      • #4
        Originally posted by Floris
        Step 1.
        Create a directory with the logo's and name them
        1.gif, 2.gif, 3.gif, etc.
        what should the directory be called?

        TIA

        Comment


        • #5
          Floris, that's nice! Thanks.
          [URL="http://coolscifi.com"]Cool Sci-Fi[/URL="http://coolscifi.com"] | [URL="http://awalkerbit.me"]Walking Dead[/URL="awalkerbit.me"]

          Comment


          • #6
            Originally posted by RichTJ99
            what should the directory be called?

            TIA
            That doesn't really matter. As long as it links to the right files.
            You can put everything in images/random/ and the index.php too. (not the index one from vb)
            Then in your header template <img src="images/random/index.php" />

            Comment


            • #7
              Thanks Floris, it works great.

              Just wondering, is there a way to have a different header show up on certain forums without doing the "parent/child" thing? We have a few forums that we would like a different logo/header displayed but at the same time we have multiple styles so the whole "parent/child" thing doesn't seem like it would work. Right now we have a different logo folder set up for each style.

              TIA

              Comment


              • #8
                Is there maybe a way to incorporate the code from this old thread into the php file above?

                Thanks for your time

                Comment


                • #9
                  -bump-

                  Comment


                  • #10
                    You can use conditionals in the template to use different code for different forums.

                    <if condition="$forumid == '5'"><img src="logo1.php" border="0" /><else /><img src="logo2.php" border="0" /></if>

                    This way it shows a default logo for all - random one - and only a differnet one for forumid 5.
                    Last edited by Floris; Mon 27th Dec '04, 4:13am. Reason: Fixed conditional.

                    Comment


                    • #11
                      ok, what am I doing wrong?

                      Code:
                          <td width="469" height="137" align="left" valign="top"><if condition="$forumid == '39'><img src="tren_z/logo/6rr.jpg" width="469" height="137" alt="" /><else /><img src="tren_z/logo/logo.php" width="469" height="137" alt="" /></if></td>

                      Comment


                      • #12
                        I get different errors depending on if I leave the code in a single line or if I break it out into multiple line. Either way it will not work for me. I'm sure it's something I'm doing wrong, any help would be much appreciated. TIA

                        Comment


                        • #13
                          <if condition="$forumid == '39'>

                          should be

                          <if condition="$forumid == '39'">

                          Comment

                          Loading...
                          Working...
                          X