Login   Register  
PHP Classes
elePHPant
Icontem

File: sample_swfobject.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Tom Schaefer  >  QOpenFlash  >  sample_swfobject.php  >  Download  
File: sample_swfobject.php
Role: Example script
Content type: text/plain
Description: Showing how to use OFC in combination with QSWFObject.
Class: QOpenFlash
Display charts using Open Flash
Author: By
Last change: elim. error
Date: 2008-06-08 02:44
Size: 1,541 bytes
 

Contents

Class file image Download
<HTML>
<BODY bgcolor="#FFFFFF"><?php
$dim 
= array("w" => 400"h" => 300);
$library_charts $library "/charts_library";
/**
* ATTENTION:
* This sample does only work in combination with QOpenFlash
* You have to provide the path to QOpenFlash class too.
* Look at the include and config section
*/

// includes
include_once("{path-to-QSWFObject}/QSWFObject.class.php");

// config
$config = array(
    
"width"=>$dim["w"],
    
"height"=>$dim["h"],
    
"path"=>"{path-to-ofc}/open_flash_chart",
    
"url"=>"sample_bar3d.php",
    
"id"=>"o".substr(md5(rand()),0,7),
    
"bgcolor" => "#ffffff"
);

// swf object
$swfObject = new SWFObject();
$swfObject->addConfig($config);
$swfObject->init();
$swfObject->setParam(array("name"=>"movie""value"=> $config["path"].'/open-flash-chart.swf?width='$config["width"] .'&height='$config["height"] . '&data='$config["url"]));
$swfObject->setParam(array("name"=>"quality""value"=>"high"));
$swfObject->setParam(array("name"=>"bgcolor""value"=>$config["bgcolor"]));
$swfObject->setEmbed(
    array(
        
"src"=> $config["path"].'/open-flash-chart.swf?width='$config["width"] .'&height='$config["height"] . '&data='$config["url"],
        
"quality" => "high",
        
"bgcolor" => "#".$config["bgcolor"],
        
"width"=>$dim["h"], 
        
"height"=>$dim["h"],
        
"name" => "charts",
        
"id" => "charts",
        
"swLiveConnect" => "true",
        
"type" => "application/x-shockwave-flash",
        
"pluginspage" => "http://www.macromedia.com/go/getflashplayer"
    
)
);
$swfObject->render();
?></BODY>
</HTML>