-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpage.php
More file actions
135 lines (123 loc) · 3.2 KB
/
page.php
File metadata and controls
135 lines (123 loc) · 3.2 KB
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
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
<?php
class page{
//class page's attributes
public $content;
public $title = "TLA Consulting Pty Ltd";
public $keywords = "TLA Consulting, Three Letter Abbreviation,
some of my best friends are search engines";
public $buttons = array("Home" => "home.php",
"Contact" => "contact.php",
"Servcies" => "services.php",
"Site Map" => "map.php"
);
//class Page's operations
public function __set($name, $value){
$this->$name = $value;
}
public function Display(){
echo "<html>\n<head>\n";
$this->DisplayTitle();
$this->DisplayKeywords();
$this->DisplayStyles();
echo "</head>\n<body>\n";
$this->DisplayHeader();
$this->DisplayMenu($this->buttons);
echo $this->content;
$this->DisplayFooter();
echo "</body>\n</html>\n";
}
public function DisplayTitle(){
echo "<title>".$this->title."</title>";
}
public function DisplayKeywords(){
echo "<meta name=\"keywords\" content=\"".$this->keywords."\"/>";
}
public function DisplayStyles(){
?>
<style>
h1 {
color:white; font-size:24pt; text-align:center;
font-family:arial,sans-serif
}
.menu {
color:white; font-size:12pt; text-align:center;
font-family:arial,sans-serif; font-weight:bold
}
td {
background:black
}
p {
color:black; font-size:12pt; text-align:justify;
font-family:arial,sans-serif
}
p.foot {
color:white; font-size:9pt; text-align:center;
font-family:arial,sans-serif; font-weight:bold
}
a:link,a:visited,a:active {
color:white
}
</style>
<?php
}
public function DisplayHeader()
{
?>
<table width="100%" cellpadding="12" cellspacing="0" border="">
<tr bgcolor = "black">
<td align = "left"><img src="logo.gif" /></td>
<td>
<h1>TLA Consulting Pty Ltd</h1>
</td>
<td align = "right"><img src="logo.gif" /></td>
</tr>
</table>
<?php
}
public function DisplayMenu($buttons){
echo "<table width = \"100%\" bgcolor = \"white\"
cellpadding= \"4\" cellspacing = \"4\">\n";
echo "<tr>\n";
//calculate button size
$width = 100/count($buttons);
while (list($name, $url) = each($buttons)) {
$this-> DisplayButton($width, $name, $url, !$this->IsURLCurrentPage($url));
}
echo "</tr>\n";
echo "</table>\n";
}
public function IsURLCurrentPage($url){
if (strpos($_SERVER['PHP_SELF'], $url)==false){
return false;
}else {
return true;
}
}
public function DisplayButton($width, $name, $url, $active = true){
if ($active){
echo "<td width = \"".$width."%\">
<a href=\"".$url."\">
<img src=\"s-logo.png\" alt=\"".$name."\" border=\"0\" /></a>
<a href=\"".$url."\"><span class=\"menu\">".$name."</span></a>
</td>";
} else {
echo "<td width=\"".$width."%\">
<img src=\"side-logo.jpg\">
<span class=\"menu\">".$name."</span>
</td>";
}
}
public function DisplayFooter(){
?>
<table width="100%" bgcolor="black" cellpadding="12" border="">
<tr>
<td>
<p class="foot">© TLA Consulting Pty Ltd.</p>
<p class="foot">Please see our <a href = "">legal information page</a></p>
</td>
</tr>
</table>
<?php
}
}
?>