Results 1 to 6 of 6

Thread: Advertisement rotator for vshare

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2008
    Posts
    216

    Default

    I re-uploaded the original rotate.zip by Anthony here: http://silkut.com/rotate.zip
    ;-)

  2. #2

    Default Url

    Hello, The URL is not working
    Quote Originally Posted by ramius View Post
    I re-uploaded the original rotate.zip by Anthony here: http://silkut.com/rotate.zip
    ;-)

  3. #3

    Default

    Create a folder called rotate

    Create file called rotate.php in the folder and add the following code

    <?php/*


    */// Make this the relative path to the images, like "../img" or "random/images/".
    // If the images are in the same directory, leave it blank.
    $folder = '';


    // Space seperated list of extensions, you probably won't have to change this.
    $exts = 'html';


    $files = array(); $i = -1; // Initialize some variables
    if ('' == $folder) $folder = './';


    $handle = opendir($folder);
    $exts = explode(' ', $exts);
    while (false !== ($file = readdir($handle))) {
    foreach($exts as $ext) { // for each extension check the extension
    if (preg_match('/\.'.$ext.'$/i', $file, $test)) { // faster than ereg, case insensitive
    $files[] = $file; // it's good
    ++$i;
    }
    }
    }
    closedir($handle); // We're not using it anymore
    mt_srand((double)microtime()*1000000); // seed for PHP < 4.2
    $rand = mt_rand(0, $i); // $i was incremented as we went along


    header('Location: '.$folder.$files[$rand]); // Voila!
    ?>
    Create html files with your advertisiments in the rotate folder (MUST BE HTML FILES) Be sure to add meta refresh on the first line of every html file

    <metahttp-equiv="refresh"content="5">
    Call the advertisments with a i frame Change the size to what you need!!

    <iframe src="rotate/rotate.php" width="770" height="150"></iframe>

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •