PHP Classes

File: sample.php

Recommend this page to a friend!
  Classes of Tom Schaefer   QXML   sample.php   Download  
File: sample.php
Role: Example script
Content type: text/plain
Description: Sample File
Class: QXML
XML <> Array (preserve attrib.), JSON, etc.
Author: By
Last change: - adding header
Date: 16 years ago
Size: 1,573 bytes
 

Contents

Class file image Download
<?php
include("QXml.class.php");

$caption = "Vacation";

$nodes = array(
 
"@attributes" => array(
   
"dateformat" => "yyyy-mm-dd",
   
"dateformat" => "yyyy-mm-dd",
   
"hoverCapBorderColor" => "2222ff",
   
"hoverCapBgColor" => "e1f5ff",
   
"ganttWidthPercent" => 60,
   
"ganttLineAlpha" => 80,
   
"canvasBorderColor" => "024455",
   
"canvasBorderThickness" => 0,
   
"gridBorderColor" => "4567aa",
   
"gridBorderAlpha" => 20,
  ),
 
"categories" => array(
    array(
     
"@attributes" => array(
       
"bgColor" => "4567aa"
     
),
     
"category" => array(
        array(
         
"@attributes" => array(
           
"start" => "2008-01-01",
           
"end" => "2008-12-31",
           
"align" => "center",
           
"fontColor" => "ffffff",
           
"isBold" => 1,
           
"fontSize" => 14,
           
"name" => $caption,
            )
        ),
        array(
         
"@attributes" => array(
           
"start" => "2008-01-01",
           
"end" => "2008-12-31",
           
"align" => "center",
           
"font" => "Verdana",
           
"fontColor" => "ffffff",
           
"isBold" => 1,
           
"fontSize" => 11,
           
"name" => "Monate",
            ),
        ),
        array(
         
"@attributes" => array(
           
"bgColor" => "4567aa",
           
"fontColor" => "ff0000",
            ),
        ),
       
      )
    )
  )
);

$xml = new QXML;
$xml->toXML($nodes);
header("content-type:text/xml");
echo
$xml->asXML();

?>