1 Reply Latest reply on Aug 14, 2007 10:19 AM by Newsgroup_User

    load random iframe

    javichampagne
      Hi: I would like to know if anyone can help me with this issue:

      I'm developing a web site with an iframe in the center of its main content with featured products.

      I want the index.html, where the iframe it's included, to change it every time the page reloads, loading random htmls from a specified folder to display in the iframe area.

      I don't know if I'm clear enough... perhaps my English is not very good. I would appreciate any help. Thanks a lot.
        • 1. Re: load random iframe
          Level 7
          javichampagne wrote:

          > Hi: I would like to know if anyone can help me with this issue:
          >
          > I'm developing a web site with an iframe in the center of its main content
          > with featured products.
          >
          > I want the index.html, where the iframe it's included, to change it every time
          > the page reloads, loading random htmls from a specified folder to display in
          > the iframe area.
          >
          > I don't know if I'm clear enough... perhaps my English is not very good. I
          > would appreciate any help. Thanks a lot.
          >

          Does your server support a server langauge like php?

          If so insert the following piece of php code into the top of your page.
          1,14 being the number of files in your specified folder, change it to
          suit how many files there are ie (1,5) (1,8) (1,11) etc

          <?php
          // Set the lowest & highest numeric point in you series names of your
          includes files
          $sl = rand(1,14);
          ?>


          Then insert this in the table cell or <div> where you need the random
          file called in

          <?php
          include ('random_pages/file_'.$sl.'.php');
          ?>


          'random_pages' being the folder name the files are in. Name the files in
          the folder file_1.php, file_2.php, file_3.php etc


          Obviously you need php running on a server but you can use other server
          languages as well but youll have to google to find out some code. I'm
          sure it works similar.