PHP Classes

File: test.php

Recommend this page to a friend!
  Classes of Vagharshak Tozalakyan   Concurrent Code Rotator   test.php   Download  
File: test.php
Role: Example script
Content type: text/plain
Description: Sample code
Class: Concurrent Code Rotator
Serve a random advertisement from multiple options
Author: By
Last change:
Date: 19 years ago
Size: 735 bytes
 

Contents

Class file image Download
<?php

// Include class definition.
require_once 'ccrotator.class.php';

// File to keep counter information, should have writing permissions.
$counter_file = 'tracker';

// Create class object.
$ccr = new CodeRotator ( $counter_file );

// Add codes to be randomly displayed.
// Work cycle will finish after 2+5+7+3+3=20 exposures.
$ccr->AddCode ( 'b1', '<p>code1</p>', 2 );
$ccr->AddCode ( 'b2', '<p>code2</p>', 5 );
$ccr->AddCode ( 'b3', '<p>code3</p>', 7 );
$ccr->AddCode ( 'b4', '<p>code4</p>', 3 );
$ccr->AddCode ( 'b5', 'includes/code.txt', 3, FROM_FILE );

// Comment next line if you do not want to display debug information.
$ccr->debug_mode = TRUE;

// Display selected code.
$ccr->ShowCode ( );

?>