PHPBuddy.com
 PHP Function Lookup:
 
Categories
PHP Quick Start
PHP Installation
PHP Articles
PHP Scripts

Top Rated Articles 
  • Simple Ad Rotator
  • PHP and Cookies
  • Getting Screen resolution using JavaScripts & PHP
  • Using Functions in PHP
  • PHP Sessions

  • Site Related
    Submit Articles/Code
    Contact Us
    Home

       Home                   Article Added on: April 6, 2002
    Simple Ad Rotator

    Overview: Creating a simple ad-rotator, the ads are stored in a text file and picked randomly by this PHP code.

    Most of the webmaster use banner ads, we will be creating a very simple banner rotator, which picks up randomly one ad from the banner file and displays it, this file can be called in any other page to display the banners.

    We will be storing banner ads in a text file banner_ads.txt

    banner_ads.txt

    Note that the banners are seperated by ~ in our banner file.

    ad_rotator.phpView Sample Output


    The above 'ad_rotator.php' can be included in any PHP page to display a banner ad by using include 'ad_rotator.php'; tag wherever banner is required.

    The above concept can be also be used to display random quotes etc, just modify the banners_ads.txt with the random content you want.

     
    Rate this article:  Current Rating: 4.42
      Poor    Excellent     
              1     2    3    4    5

     

    Home | Privacy Policy | Contact Us | Terms of Service
    (c) 2002 - 2017 PHPbuddy.com Unauthorized reproduction/replication of any part of this site is prohibited.