Announcement Announcement Module
Collapse
No announcement yet.
Rotating banners Page Title Module
Move Remove Collapse
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Rotating banners

    #1
    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!

  • #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="">

    Comment


    • #3
      Thanks!

      Comment


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

        is there a decent guide online for this?

        thanks

        Comment


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

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

          Comment

          • 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.

              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, 11:00 PM.

                  Comment


                  • #10
                    thanks if this works i owe you one! .. or two!

                    Comment

                    Google search Google search Module
                    Collapse
                    Latest Topics Latest Topics Module
                    Collapse
                    • <b>'s Avatar
                      Commented to Sketching
                      Sketching, handwriting and drawing are two different things, so what works in one might not work in another.

                      Buda mentioned the Palmer Method. This was a handwriting technique that was taught...
                    • <b>'s Avatar
                      Further up in the thread Darkwolf29a and I questioned your use of the <base> tag. The base tag isn't typically used, but it serves as an instruction to regard the URL within the tag as the root...
                    • RichardCl's Avatar
                      Thanks.

                      I took a look at luxe -- looks good. Looks like it's digitally printed -- would that be as good as litho or letterpress?

                      Engraving sounds interesting. I'll look into...
                    • <b>'s Avatar
                      Similar, but more expensive and classy, is engraving. Combining an ultra-minimalist, bare-bones design with something as elegant, tactile and expensive as engraving can really have a nice, exclusive,...
                    • richcohen's Avatar
                      Hi all,
                      I am venturing out into looking for my next FT gig - and would like some feedback on my website - appearance and content as well as my portfolio.
                      thanks.
                    • hank_scorpio's Avatar
                      Yeh - copped that later on but hard to compare side by side lol.
                    • Red Kittie Kat's Avatar
                      Commented to Typographic Art
                      Nope nothing attached .... I see you tried to post an image from here but, that didn't work either I'm afraid

                      The new update is not all that user friendly. You could post a link to the...
                    • Designia's Avatar
                      Commented to Typographic Art
                      I don't see anything attached.
                    All Creative World Network All Creative World Network Module
                    Collapse
                     
                    home | site map | advertising/sponsorships | about us | careers | contact us | help courses | browse jobs | freelancers | events | forums | content | member benefits | reprints & permissions about | terms of use | privacy policy | Copyright © 2013 Mediabistro Inc. Mediabistro Inc. call (212) 389-2000 or email us
                    Working...
                    X