File: v03/sample.php

Recommend this page to a friend!
  Classes of Tom Schaefer  >  Script Progress  >  v03/sample.php  >  Download  
File: v03/sample.php
Role: Example script
Content type: text/plain
Description: Sample using notification and definition list
Class: Script Progress
Flush page output to show progress of server task
Author: By
Last change:
Date: 8 years ago
Size: 710 bytes
 

Contents

Class file image Download
<?php

include_once 'class.0.3.php';

$buff = new ScriptProgress(10, 10000);
$buff->addStylesheet();
$buff->addScript();

$data = array("initialize", "configure", "prepare process", "process", "post process", "send", "log", "render", "deliver", "done", "");

$c = count($data);
foreach(
$data as $index => $message) {
 
$rt = rand(100000, 999999);
  if(
$index==0) {
   
$buff->set("<ul>");
  } else {
     
$buff->set("<li></li>");
  }
 
$buff->next();
  if(
$index < $c - 1){
   
usleep($rt); // simulate real runtime 0.1 upt to 1 sec
   
$buff->notify($message, number_format($rt / 1000000, 3, '.', ''));
  }
 }

# end operation
$buff->set("</ul>");
$buff->next();

$buff->end();


For more information send a message to info at phpclasses dot org.