My favorites | Sign in
Project Home Downloads Wiki Issues Source
Checkout   Browse   Changes    
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php

/*
* (c) Copyright 2008 Hewlett-Packard Development Company, L.P.
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use,
* copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following
* conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
* OTHER DEALINGS IN THE SOFTWARE.
*
*/

require_once("Gagawa.php");

$a = new A();

// Note you can daisy chain attribute setters.
$a->setHref( "http://kolich.com" )
->setTarget("_blank")
->setCSSClass("linkclass")
/*->setAttribute("","") <-- will generate an expected exception */
->setId("myid")
->setAttribute("otherattr","other");

// Note you can daisy chain children setters.
$a->appendChild( new Text("random text") )->appendChild( new Br() )
->appendChild( new Text("more text") )->appendChild( new Br() )
/*->appendChild() <-- will generate an expected exception */
->appendChild( new Text("gagawa!" ) );

echo $a->write() . "\n";

// Example of creating a new FertileNode without the helper classes
$div = new Div();
$div->setCSSClass("dog")->setId("mydiv");
$div->appendChild( new Text("inside of a div") );

$ab = new A();
$ab->setHref("http://example.com");
$ab->appendChild( new Text("link inside of a div!") );
$div->appendChild( $ab );

echo $div->write() . "\n";

?>

Change log

r38 by html-gen...@hp.com on Dec 26, 2008   Diff
Packaged the element classes into
Gagawa.php so it's eaiser to include
Gagawa in a PHP webapp (you only have to
require_once() a single file instead of
three).
Go to: 
Project members, sign in to write a code review

Older revisions

r36 by html-gen...@hp.com on Dec 26, 2008   Diff
Packaged the Attribute, Node, and
FertileNode classes into Gagawa.php so
it's eaiser to include Gagawa in a PHP
webapp (you only have to
require_once() a single file instead
...
r32 by html-gen...@hp.com on Dec 26, 2008   Diff
Added inital version of PHPBuilder and
all of the PHP classes that were built
from PHPBuilder into
src/com/hp/gagawa/php/elements/.  Run
Example.php under
...
r30 by html-gen...@hp.com on Dec 25, 2008   Diff
Beefed up the Gagawa PHP example,
Example.php.
All revisions of this file

File info

Size: 2122 bytes, 61 lines

File properties

svn:mergeinfo
Powered by Google Project Hosting