Login   Register  
PHP Classes
elePHPant
Icontem

File: sample.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  >  TypeSafeStruct  >  sample.php  >  Download  
File: sample.php
Role: Example script
Content type: text/plain
Description: as the name says
Class: TypeSafeStruct
Manipulate type safe objects
Author: By
Last change: chg
Date: 2009-03-14 08:37
Size: 712 bytes
 

Contents

Class file image Download
/**
 * @author Thomas Schaefer
 * @mail scaphare@gmail.com
*/

// classes
include "TypedStruct.class.php";
include "TypeSafeStruct.class.php";
include "SerializeTypedStruct.class.php";

// sample model
include "Model_Objects_Countries.php";

// instantiate
$clsObject = new Model_Objects_Countries;

// add some data
$clsObject->setContinent("Asia");
$clsObject->setCode("ALC");

switch($_GET["format"]){
    case "xml":
        header("content-type:text/xml");
        echo SerializeTypedStruct::toXML($clsObject);        
        break;
    case "sqlInsert":
        echo SerializeTypedStruct::sqlInsert($clsObject,"Countries");
        break;
    default:
        print "<pre>";
        echo $clsObject;
        print "<pre>";
        break;
}