Skip to content

Шаблонизация проекта #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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

Glorferiel39
Copy link
Contributor

@Glorferiel39 Glorferiel39 commented Dec 12, 2024

Добавлены шаблоны для сайта в корневой папке проекта => templates/...
Перемещена функция для форматирования суммы в файл helpers.php


🎓 Шаблонизация проекта

@@ -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

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');

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

всегда нужно использовать обратные слэши в путях / - будут работать как в windows, так и в linux

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', [

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', [

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$layoutContent

'pic' => 'img/lot-6.jpg'
]
];
?>

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', [

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

includeTemplate(...) саму функцию переименовать

@keksobot keksobot changed the title ШАБЛОНИЗАЦИЯ ПРОЕКТА Шаблонизация проекта Jan 14, 2025
@keksobot
Copy link
Contributor

Не удалось смёржить пулреквест. Проверьте наличие конфликтов. Задание переведено в статус Есть замечания

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants