Files
BiveEngine/playarea/templates/pages/posts.php
2025-12-24 19:19:01 +03:00

61 lines
3.0 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php $page = $b->ls_get_key("page"); ?>
<?php $this->template_load("head.php"); ?>
<?php $this->template_load("header.php"); ?>
<?php
$category_slug = $page->get_item_slug();
$current_page = $_GET["page"] ?? 1;
$posts_per_page = 30;
$posts_params = array(
"category_id" => $page->item_id,
"page" => $current_page,
"products_per_page" => $posts_per_page
);
$posts = posts_search($posts_params);
$posts_count = posts_search_count($posts_params);
?>
<section class="section first-other blog news">
<div class="container">
<h1 class="little blog__heading"><?= $page->get_item_name(); ?></h1>
<div class="blog__wrapper blog-wrapper">
<div class="reviews-block__tabs rev-tabs row align-items-center">
<a class="news__btn <?= $category_slug == "all-publications" ? "active" : ""; ?>" href="/posts/all-publications/">Все публикации</a>
<a class="news__btn <?= $category_slug == "articles" ? "active" : ""; ?>" href="/posts/articles/">Статьи</a>
<a class="news__btn <?= $category_slug == "news" ? "active" : ""; ?>" href="/posts/news/">Новости</a>
<a class="news__btn <?= $category_slug == "sale" ? "active" : ""; ?>" href="/posts/sale/">Акции</a>
</div>
<article class="news-articles blog__articles blog-articles row">
<h2 class="little visually-hidden">[Статьи]</h2>
<div class="blog-articles__list row news-articles">
<?php foreach ($posts as $key => $post) { ?>
<article class="news-articles__item news-articles__item_long" data-article="Статья">
<div class="news-articles__top">
<p class="rev-slide__date"><?= $post->get_prop("create_date"); ?></p>
<a href="/post/<?= $post->get_item_slug(); ?>/" class="news-articles__link"><?= $post->get_item_name(); ?></a>
<p class="news-articles__excerpt">
<?php
$trimmedString = substr($post->get_prop("quick"), 0, 100);
if (strlen($post->get_prop("quick")) > 100) $trimmedString .= '...';
?>
<?= $trimmedString; ?>
</p>
</div>
<figure class="news-articles__image">
<img src="<?= $post->get_prop_render_value("post_photo"); ?>" alt="" />
</figure>
</article>
<?php } ?>
</div>
</article>
</div>
<div class="posts-pagination">
<?php $b->template_load("productCategory/pagination.php", array("current_page" => $current_page, "items_per_page" => $posts_per_page, "items_count" => $posts_count)); ?>
</div>
</div>
</section>
<?php $this->template_load("footer.php"); ?>