PHP Classes
elePHPant
Icontem

File: demos/001.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  >  d3Prototype  >  demos/001.php  >  Download  
File: demos/001.php
Role: Example script
Content type: text/plain
Description: first steps
Class: d3Prototype
Generate JavaScript to use the Prototype framewor
Author: By
Last change:
Date: 2 years ago
Size: 1,213 bytes
 

Contents

Class file image Download
<?php

include_once '../d3.classes.inc.php';
include_once
'../prototype.class.inc.php';


$person = cls()->create()->createVar("Person");
$person->toStack("Person");

obj(array(
 
"initialize" => function($name){$this->name = $name;},
 
"say" => function($name){return $this->name.": "+$message;}
  ))
  ->
createVar( $person->get()->prototype(cls::property), false, false )
  ->
toStack();

stack()->colon()->line()->line();

$guy = cls("Miro", $person->getVar())->createVar("guy");
$guy->toStack("guy");
$guy->get()
  ->
say("hi")
  ->
toStack();

stack()->line()->line();



$pirate = cls()->create()->createVar("Pirate");
$pirate->toStack("Pirate");

Object()->extend(
 
$person->getVar()->newInstance(),
 
obj(array(
   
"say" => function($name){return $this->name.": "+$message+", yarr!";}
  ) )
)
->
createVar( $pirate->get()->prototype(Object::property), false, false )
->
toStack();


stack()->colon()->line()->line();



$john = cls("Long John", $pirate->getVar())
  ->
createVar("john", true)
  ->
toStack("john");

stack()->get("john")->get()
  ->
say("ahoy matey")
  ->
toStack();

stack()->colon()->line()->line();



echo
stack()->getInstance();