Announcement

Collapse
No announcement yet.

Rotating banners

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

  • Rotating banners

    Hi,

    I am looking to have the banners on this website at the top of the page change every-time the page is refreshed,

    http://www.jhooakley.com/

    Is there an easy way to do this... Bearing in mind web coding is not my fortay.



    Thanks!
    Richard Lock Artwork for Music and Media DEVOLUTION DESIGNS - CLICK HERE

    Type One Creative, graphic and web design services in the UK TYPE ONE CREATIVE - CLICK HERE

  • #2
    You can do it with PHP or Javascript. The dead easiest way to do it is to number your images, like banner1.jpg banner2.jpg banner3.jpg and have JS or PHP choose a random number between 1 and 3.

    PHP I'd favor because it'll work before the page is loaded and if JS is turned off.

    Code:
    <img src="/img/banner<?php echo rand(1,3); ?>.jpg" alt="">
    Swedish Meatball Pornography

    Comment


    • #3
      Thanks!
      Richard Lock Artwork for Music and Media DEVOLUTION DESIGNS - CLICK HERE

      Type One Creative, graphic and web design services in the UK TYPE ONE CREATIVE - CLICK HERE

      Comment


      • #4
        i ma still struggling with this.. cant get swf files to rotate..

        is there a decent guide online for this?

        thanks
        Richard Lock Artwork for Music and Media DEVOLUTION DESIGNS - CLICK HERE

        Type One Creative, graphic and web design services in the UK TYPE ONE CREATIVE - CLICK HERE

        Comment


        • #5
          try this website to code a simple on with php:

          http://jwpctips.com/internet/how-mak...cript-php.html

          Comment


          • #6
            http://www.developertutorials.com/sc...tails/7679.php
            Broke or just cheap? Read my list of free open source alternatives to Adobe Creative Suite software.

            Comment


            • #7
              still none the wiser!!! lol.
              Just cant get them to work at all. I can get giffs to rotate but not SWf files


              I just need some code i can copy an paste if possible.
              Richard Lock Artwork for Music and Media DEVOLUTION DESIGNS - CLICK HERE

              Type One Creative, graphic and web design services in the UK TYPE ONE CREATIVE - CLICK HERE

              Comment


              • #8
                Post all the code for the page including the PHP.

                Comment


                • #9
                  Code:
                  <?php 
                  
                  /* files to rotate */
                  $files = array('aaa.gif','bbb.gif','ccc.gif','ddd.swf','fgtr.swf');
                  
                  /* current file */
                  $file = isset($_COOKIE['file']) && in_array($_COOKIE['file'],$files)?$_COOKIE['file']:null;
                  
                  /* remove previous file shown */
                  if($file !== null) {
                  	$filesIndex = array_search($file,$files);
                  	array_splice($files,$filesIndex,1);
                  }
                  
                  /* choose a new file to show */
                  $filesIndex = array_rand($files,1);
                  $file = $files[$filesIndex];
                  
                  // save file to cookie
                  setcookie('file',$file);
                  
                  // get the files extension to determine how to show it
                  $filesExtension = strrpos($file,'.') === false?'':substr($file,(strrpos($file,'.')+1));
                  
                  // alternate display implementation for an image and swf
                  switch($filesExtension) {
                  	case 'swf':
                  		echo "<p>Showing Flash: $file</p>";
                  		break;
                  	
                  	default:
                  		echo "<p>Showing Image: $file</p>";
                  }
                  ?>
                  Test it out to see what it does and let me know if that is what your after.

                  If it is then I'll show you next step once your code is posted.
                  Last edited by tZ; 11-03-2009, 07:00 PM.

                  Comment


                  • #10
                    thanks if this works i owe you one! .. or two!
                    Richard Lock Artwork for Music and Media DEVOLUTION DESIGNS - CLICK HERE

                    Type One Creative, graphic and web design services in the UK TYPE ONE CREATIVE - CLICK HERE

                    Comment

                    Search

                    Collapse

                    Advertisement

                    Collapse

                    Latest Topics

                    Collapse

                    • bigdata
                      Reply to What was your path to the world of design?
                      bigdata
                      B

                      It seems that I've been designing since ever. One way or another. Even as a child I drew designs all over my bedroom walls. I have absolutely no idea why or how for that matter, just natural...
                      Today, 04:42 AM
                    • B
                      Reply to Help with the lost website!
                      B
                      FTP is short for File Transfer Protocol, which is just an Internet protocol used to transfer files to and from FTP-enabled servers. An FTP client would typically be used to retrieve the actual WordPress...
                      Yesterday, 10:25 PM
                    • pilotguy251
                      Reply to Tips on a redesign of my logo/watermark?
                      pilotguy251
                      I apologize and thanks for your response. Took a look at the Forum Rules, FAQ's and Guidelines as I like to post in the most respectful way possible when joining a new forum. Here it is in full size...
                      Yesterday, 10:20 PM
                    • Aur0x
                      Forum singnature
                      Aur0x
                      Hi guys

                      ide like to get a forum signature done up for me. It needs to be 555 pixels by 125 pixels

                      i want to use this image and have my name (Aur0xx) in red in a cool font to...
                      Yesterday, 09:16 PM
                    • PanToshi
                      Reply to Tips on a redesign of my logo/watermark?
                      PanToshi
                      Hi Pilotguy and welcome to GDF.

                      I can't see the mark too well with the added watermark over it. You say it contains a plane and a train (which I can't see). Where did you get those elements?...
                      Yesterday, 08:26 PM

                    GDF A division of Mediabistro Holdings Adweek | Mediabistro | Clio | Film Expo Group Contact Us | Terms of Use | Privacy Policy Copyright 2016 Mediabistro Holdings
                    Working...
                    X