-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpageGenerator.php
More file actions
92 lines (72 loc) · 1.91 KB
/
pageGenerator.php
File metadata and controls
92 lines (72 loc) · 1.91 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
<?php namespace pageGenerator;
use headGenerator;
use bodyGenerator;
class PageStart{
public function __construct($title, $specificLayoutFileName){
$this -> generateHead($title, $specificLayoutFileName);
$this -> startBody();
}
function generateHead($title, $specificLayoutFileName){
$headInfo = new headGenerator\HeadInfo(
"lv", $title,
"standartLayout.css",
$specificLayoutFileName);
headGenerator\defaultHead($headInfo);
}
function startBody(){
bodyGenerator\startBody();
}
}
function finishPage(){
bodyGenerator\finishBody();
echo "</html>";
}
?>
<?php namespace headGenerator;
class HeadInfo{
public $language;
public $title;
public $defaultLayoutFileName;
public $specificLayoutFileName;
public function __construct(
$language, $title,
$defaultLayoutFileName, $specificLayoutFileName){
$this->language = $language;
$this->title = $title;
$this->defaultLayoutFileName = $defaultLayoutFileName;
$this->specificLayoutFileName = $specificLayoutFileName;
}
}
function defaultHead($headInfo){
echo "<!DOCTYPE html>";
echo '<html lang="' . $headInfo->language . '">';
echo "<head>";
echo '<meta charset="utf-8">';
readStyles(
$headInfo->defaultLayoutFileName,
$headInfo->specificLayoutFileName);
setTitle($headInfo->title);
echo "</head>";
}
function readStyles(
$defaultLayoutFileName,
$specificLayoutFileName){
$_start = '<link rel="stylesheet" type="text/css" href="';
$_end = '">';
echo $_start . $defaultLayoutFileName . $_end;
echo $_start . $specificLayoutFileName . $_end;
}
function setTitle($title){
echo "<title>";
echo $title;
echo "</title>";
}
?>
<?php namespace bodyGenerator;
function startBody(){
echo "<body>";
}
function finishBody(){
echo "</body>";
}
?>