-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpage.php
More file actions
117 lines (106 loc) · 3.14 KB
/
Copy pathpage.php
File metadata and controls
117 lines (106 loc) · 3.14 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
<?php
// echo 'Это главный файл.<br/>';
// require ('reusable.php');
// echo 'Сейчас сценарий завершится.<br/>';
class Page
{
public $content;
public $title = "TLA Consulting Pty Ltd";
public $keywords = "TLA consulting, Three Letter Abbreviation,
поисковые механизмы - наши лучшие друзья";
public $buttons = array("Домой" => "home.php",
"Контакт" => "contact.php",
"Услуги" => "services.php",
"Карта сайта" => "map.php"
);
/** @noinspection MagicMethodsValidityInspection */
public function __set(string $name, $value): void
{
$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>";
}
public function DisplayTitle()
{
echo "<title>" . $this->title . "</title>";
}
public function DisplayKeywords()
{
echo "<meta> name='keywords' content='" . $this->keywords . "'/>";
}
public function DisplayStyles()
{
?>
<link rel="stylesheet" href="styles.css" type="text/css">
<?php
}
public function DisplayHeader()
{
?>
<!-- верхний колонтикул страницы -->
<header>
<img src="#" alt="TLA logo" height="70" width="70">
<h1>TLA Consulting</h1>
</header>
<?php
}
public function DisplayMenu($buttons)
{
echo "<!-- меню -->
<nav>";
while (list($name, $url) = each($buttons)) {
$this->DisplayButton($name, $url,
!$this->IsURLCurrentPage($url));
}
echo "</nav>\n";
}
public function IsURLCurrentPage($url)
{
if (strpos($_SERVER['PHP_SELF'], $url) === false) {
return false;
} else {
return true;
}
}
public function DisplayButton($name, $url, $active = true)
{
if ($active) { ?>
<div class="menuitem">
<a href="<?= $url ?>">
<img src="#" alt="" height="20" width="20">
<span class="menutext"><?= $name ?></span>
</a>
</div>
<?php
} else { ?>
<div class="menuitem">
<img src="#">
<span class="menutext"><?= $name ?></span>
</div>
<?php
}
}
public function DisplayFooter()
{
?>
<!--нижний колонтикул страницы -->
<footer>
<p>©TLA Consulting Pty Ltd.<br/>
Пожалуйста, посмотрите нашу
<a href="legal.php">страницу с юридической информацией</a>.</p>
</footer>
<?php
}
}
?>