Skip to content

Commit cd63091

Browse files
committed
init commit
0 parents  commit cd63091

File tree

6 files changed

+107
-0
lines changed

6 files changed

+107
-0
lines changed

01/functions.php

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
<?php
2+
3+
function readGuestBook($fileName)
4+
{
5+
$file = fopen($fileName, 'r');
6+
$resultArray = [];
7+
8+
while (false !== $str = fgets($file)) {
9+
$resultArray[] = trim($str);
10+
}
11+
12+
fclose($file);
13+
14+
return $resultArray;
15+
}

01/guestBook.txt

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
В лесу родилась елочка,
2+
В лесу она росла,
3+
Зимой и летом стройная,
4+
Зеленая была.

01/index.php

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<?php
2+
include __DIR__ . '/functions.php';
3+
4+
$guestBookArray = readGuestBook(__DIR__ . '/guestBook.txt'); ?>
5+
6+
<!doctype html>
7+
<html lang="ru">
8+
<head>
9+
<meta charset="UTF-8">
10+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
11+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
12+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css"
13+
integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
14+
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js"
15+
integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k"
16+
crossorigin="anonymous"></script>
17+
18+
<title>Гостевая книга</title>
19+
</head>
20+
<body>
21+
<div class="container">
22+
<div class="row">
23+
<h1>Гостевая книга.</h1>
24+
</div>
25+
<div class="row">
26+
<h2>Последние записи:</h2>
27+
</div>
28+
<?php
29+
foreach ($guestBookArray as $item) {
30+
?>
31+
<div class="row">
32+
<?php
33+
echo $item;
34+
?>
35+
</div>
36+
<?php
37+
}
38+
?>
39+
40+
</div>
41+
</body>
42+
</html>

README.md

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Home work 4
2+
3+
<div align = "center">
4+
<img src="/screens/hw04.png" width="100%">
5+
<br>
6+
</div>
7+
8+
<p align="center">
9+
<img src="https://img.shields.io/badge/PHP-7.2-orange.svg" alt="PHP-7.2"/>
10+
<img src="https://img.shields.io/badge/licence-MIT-lightgray.svg" alt="Licence MIT"/>
11+
</p>
12+
13+
## Информация для проверяющего
14+
* код к каждому заданию находится в папке под номером, который соответствует номеру задания
15+
16+
## Main functionality
17+
* uses
18+
19+
## Credits
20+
* thanks to **Albert Stepantsev** and to his [awesome school](https://pr-of-it.ru/courses/php-1.html)
21+
22+
## License
23+
24+
This project is licensed under the MIT License.

index.php

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<!doctype html>
2+
<html lang="ru">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta http-equiv="X-UA-Compatible" content="ie=edge">
6+
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
7+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css"
8+
integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
9+
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js"
10+
integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k"
11+
crossorigin="anonymous"></script>
12+
13+
<title>HomeWork 3</title>
14+
</head>
15+
<body>
16+
<p></p>
17+
<div class="container">
18+
<a href="/01" class="btn btn-primary">Task 1</a>
19+
<a href="/02" class="btn btn-primary">Task 2</a>
20+
</div>
21+
</body>
22+
</html>

screens/hw04.png

208 KB
Loading

0 commit comments

Comments
 (0)