ObjectHTML Framework 0.0.9.1 for PHP 发布.欢迎试用
测试代码:
OO的方法构造HTML代码.简约而不简单.呵呵
/Files/eicesoft/OHTML.rar
测试代码:
1
<?php
2
class Controller_Default extends FLEA_Controller_Action {
3
function actionindex(){
4
//TODO 默认首页文件
5
// $tblArticle =& FLEA::getSingleton('Model_User');
6
// $result = $tblArticle->findAll();
7
//
8
//
9
// $group =& FLEA::getSingleton('Model_Group');
10
// $result2 = $group->findAll();
11
// dump($result);
12
// dump($result2);
13
// global $___fleaphp_loaded_time;
14
// print 'Processed in ' . (number_format(getTimer(microtime())-getTimer($___fleaphp_loaded_time),5,'.',' ')*1000) . ' ms.';
15
$_loadstart_time = microtime();
16
require_once 'include/OHTML.php';
17
/* 测试部分 */
18
$html = new HTML(); //构造HTML开始
19
$script = new Script(); //构造js脚本,外链
20
$script->Src = 'jquery.js';
21
$script2 = new Script(); //构造内部js脚本
22
$script2->setHTML("function print1(){ alert('ok') }");
23
$link1 = new Link('main.css'); //联入css
24
$style1 = new Style(); //内部css
25
$style1->setHTML('*{font-size:12px;}');
26
$head = new Head('',$script.$script2.$link1.$style1); //构造Head,并添加以上几个节点
27
28
$a2 = new A('http://www.baidu.com','a1','','aa');
29
$a2->Style="color:red;font-size:12px;";
30
$a2->setHTML("张怡冰2");
31
32
$img = new Img('phpMyAdmin\themes\darkblue_orange\screen.png');
33
34
$text = new Text('input1','你好中译本');
35
$text->Style = "color:red;";
36
$text->RegisterEvent('onclick','print1();');
37
$text2 = new Text('input2','','','',TEXT_PASSWORD);
38
$text3 = new Text('input3','sdfsdfsdfasdf','','',TEXT_TEXTAREA);
39
$text3->ExpandProperty = 'rows="10" cols="40"';
40
$radio = new Radio('cc1','10','c1','',false);
41
$label = new Label('','男','','cc1');
42
$radio2 = new Radio('cc2','11','c1','',true);
43
$label2 = new Label('','女','','cc2');
44
$checkbox1 = new CheckBox('ch1','20','ch2','',true);
45
$checkbox2 = new CheckBox('ch2','22','ch2','',false);
46
$btn = new Button('btn1','你好中译本');
47
$btn->Style = "color:red;";
48
$btn2 = new Button('btn2','提交','',BUTTON_SUBMIT);
49
$form1 = new Form('post.php','post',$text.new Br().$text2.new Br().$text3.new Br().$radio.$label.$radio2.$label2.$checkbox1.$checkbox2.$btn.$btn2);
50
51
$div = new Div('a1','','',$a2.$form1.new Br());
52
$div->Style = "border:1px #ececec solid;padding:4px;";
53
$div->Title = "你好这个层里能看得到吗?";
54
55
$th1 = new Th('','编号');
56
$th2 = new Th('','姓名');
57
$th3 = new Th('','学号');
58
$th4 = new Th('','邮箱');
59
$th5 = new Th('','年龄');
60
$th6 = new Th('','其他');
61
$th7 = new Th('','操作');
62
$tr = new Tr('','',$th1.$th2.$th3.$th4.$th5.$th6.$th7);
63
$thead = new THead('',$tr);
64
65
$tbody = new TBody('');
66
for($i=0;$i<30;$i++){
67
$td1 = new Td('',$i+1);
68
$td2 = new Td('','陈嵩');
69
$td3 = new Td('','234234234235');
70
$td4 = new Td('','eicesoft@126.com');
71
$td5 = new Td('','23');
72
$td6 = new Td('','其他的信息');
73
$td7 = new Td('','添加 修改 删除');
74
$tr3 = new Tr('','',$td1.$td2.$td3.$td4.$td5.$td6.$td7);
75
$tbody->addChild($tr3);
76
}
77
$table = new Table('','','',$thead.$tbody);
78
$table->Border = 1;
79
$table->CellPadding = 2;
80
$table->CellSpacing = 2;
81
$table->Caption = '学生记录表';
82
83
$li1 = new LI();
84
$li1->setHTML("列表项1");
85
$li2 = new LI();
86
$li2->setHTML("列表项2");
87
$li3 = new LI();
88
$li3->setHTML("列表项3");
89
$li4 = new LI();
90
$li4->setHTML("列表项4");
91
92
$ul = new UL('','',$li1.$li2.$li3.$li4);
93
$ol = new OL('','',$li1.$li2.$li3.$li4);
94
95
$select = new Select('a1','','');
96
$option1= new Option('1','张怡冰');
97
$option2 = new Option('2','陈嵩');
98
99
$select->SelectValue = '2';
100
$select->Size = '12';
101
$select->addChild($option1);
102
$select->addChild($option2);
103
$body = new Body('',$div.$img.$table.$ul.$ol.$select);
104
$html->setHTML($head,$body);
105
echo $html;
106
$total = sprintf("%01.5f",microtime()-$_loadstart_time);
107
echo "<br />processed in {$total} second(s)";
108
}
109
}
110
?>

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

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

OO的方法构造HTML代码.简约而不简单.呵呵
/Files/eicesoft/OHTML.rar