Skip to content
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

pagination fix plus list with subitems #1

Merged
merged 2 commits into from Mar 26, 2021
Merged

Conversation

michey85
Copy link
Collaborator

No description provided.

@@ -51,4 +50,32 @@ function renderHtml(callable $fn, string ...$strs): void {
// принимает строку и список "запретных" слов, которые будут вырезаны
function cleanStr(string $str, string ...$args): string {
return str_replace($args, '', $str);
}

function renderHtmlList($list) {

Choose a reason for hiding this comment

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

typeHinting где?)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

да, отличный вопрос))

$result = '<ul>';

// хотелось через foreach, но по разметке не валидно получается
// foreach ($list as $item) {

Choose a reason for hiding this comment

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

точно можно через foreach, только надо кое-где инициализацию result и условия поменять)

@@ -1,6 +1,9 @@
<?php
$pageNumber = $_GET['page'] ?? 1;
const POSTS_PER_PAGE = 5;

$arr = array_chunk($posts, POSTS_PER_PAGE);

Choose a reason for hiding this comment

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

ага, теперь эллегантней!

@michey85 michey85 merged commit b528b84 into master Mar 26, 2021
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.

None yet

2 participants