-
Notifications
You must be signed in to change notification settings - Fork 1
Шаблонизация проекта #7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
@@ -19,7 +19,12 @@ function is_date_valid(string $date) : bool { | |||
|
|||
return $dateTimeObj !== false && array_sum(date_get_last_errors()) === 0; | |||
} | |||
|
|||
//Функция форматирующая сумму | |||
function formatAmount(int|float $price): string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
добавить phpdoc
index.php
Outdated
|
||
$user_name = ''; // укажите здесь ваше имя | ||
<?php | ||
require_once ('templates\data.php'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
всегда нужно использовать обратные слэши в путях /
- будут работать как в windows, так и в linux
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
либо использовать встроенную в php константу DIRECTORY_SEPARATOR:
require_once ('templates' . DIRECTORY_SEPARATOR . 'data.php');
index.php
Outdated
require_once ('templates\data.php'); | ||
require_once ('helpers.php'); | ||
|
||
$main_content = include_template('main.php', [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$mainContent (по PSR-12)
index.php
Outdated
'lots' => $lots, | ||
]); | ||
|
||
$layout_content = include_template('layout.php', [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$layoutContent
templates/data.php
Outdated
'pic' => 'img/lot-6.jpg' | ||
] | ||
]; | ||
?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
не нужно закрывать тег в php, если нет последующего кода
require_once ('templates/data.php'); | ||
require_once ('helpers.php'); | ||
|
||
$mainContent = include_template('main.php', [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
includeTemplate(...) саму функцию переименовать
Не удалось смёржить пулреквест. Проверьте наличие конфликтов. Задание переведено в статус |
Добавлены шаблоны для сайта в корневой папке проекта => templates/...
Перемещена функция для форматирования суммы в файл helpers.php
🎓 Шаблонизация проекта