更新blog界面

This commit is contained in:
2026-03-20 20:35:00 +08:00
parent b3a25ceb82
commit d30a2531a7
7 changed files with 87 additions and 94 deletions
+8 -87
View File
@@ -13,7 +13,7 @@ if ($currentPage < 1) {
$currentPage = 1;
}
$pageSize = 4; // 每页展示 4 条(grid 中每条占 col-lg-6,所以刚好行)
$pageSize = 8; // 每页展示 8 条(grid 中每条占 col-lg-6,所以刚好行)
$totalCount = count($allNewsList);
$totalPages = (int)ceil($totalCount / $pageSize);
if ($totalPages < 1) {
@@ -43,7 +43,7 @@ $newsListForPage = array_slice($allNewsList, ($currentPage - 1) * $pageSize, $pa
<div class="container">
<div class="row">
<div class="col-lg-8">
<div class="col-lg-12">
<!-- Blog Posts Section -->
<section id="blog-posts" class="blog-posts section">
@@ -74,14 +74,15 @@ $newsListForPage = array_slice($allNewsList, ($currentPage - 1) * $pageSize, $pa
$imgSrc = $baseUrl . "/themes/template3/assets/img/blog/blog-{$imgIndex}.jpg";
}
$articleUrl = $apiUrl . '/article_detail/' . ($item['id'] ?? 0);
// 文章详情链接必须走前台域名,否则 api.yunzer.cn 上租户解析不生效
$articleUrl = $baseUrl . '/article_detail/' . ($item['id'] ?? 0);
?>
<div class="col-lg-6">
<div class="col-lg-3 col-md-6">
<article>
<div class="post-img">
<img src="<?php echo htmlspecialchars($imgSrc); ?>" alt="" class="img-fluid">
<div class="post-media">
<img src="<?php echo htmlspecialchars($imgSrc); ?>" alt="" class="post-media-img" />
</div>
<p class="post-category"><?php echo htmlspecialchars($category); ?></p>
@@ -150,87 +151,7 @@ $newsListForPage = array_slice($allNewsList, ($currentPage - 1) * $pageSize, $pa
</div>
<div class="col-lg-4 sidebar">
<div class="widgets-container">
<!-- Search Widget -->
<div class="search-widget widget-item">
<h3 class="widget-title">搜索</h3>
<form action="">
<input type="text">
<button type="submit" title="Search"><i class="bi bi-search"></i></button>
</form>
</div><!--/Search Widget -->
<!-- Categories Widget -->
<div class="categories-widget widget-item">
<h3 class="widget-title">分类</h3>
<ul class="mt-3">
<li><a href="#">General <span>(25)</span></a></li>
<li><a href="#">Lifestyle <span>(12)</span></a></li>
<li><a href="#">Travel <span>(5)</span></a></li>
<li><a href="#">Design <span>(22)</span></a></li>
<li><a href="#">Creative <span>(8)</span></a></li>
<li><a href="#">Educaion <span>(14)</span></a></li>
</ul>
</div><!--/Categories Widget -->
<!-- Recent Posts Widget -->
<div class="recent-posts-widget widget-item">
<h3 class="widget-title">最新文章</h3>
<div class="post-item">
<img src="<?php echo $baseUrl; ?>/themes/template3/assets/img/blog/blog-recent-1.jpg" alt="" class="flex-shrink-0">
<div>
<h4><a href="<?php echo $baseUrl; ?>/blog-details">Nihil blanditiis at in nihil autem</a></h4>
<time datetime="2020-01-01">Jan 1, 2020</time>
</div>
</div><!-- End recent post item-->
<div class="post-item">
<img src="<?php echo $baseUrl; ?>/themes/template3/assets/img/blog/blog-recent-2.jpg" alt="" class="flex-shrink-0">
<div>
<h4><a href="<?php echo $baseUrl; ?>/blog-details">Quidem autem et impedit</a></h4>
<time datetime="2020-01-01">Jan 1, 2020</time>
</div>
</div><!-- End recent post item-->
<div class="post-item">
<img src="<?php echo $baseUrl; ?>/themes/template3/assets/img/blog/blog-recent-3.jpg" alt="" class="flex-shrink-0">
<div>
<h4><a href="<?php echo $baseUrl; ?>/blog-details">Id quia et et ut maxime similique occaecati ut</a></h4>
<time datetime="2020-01-01">Jan 1, 2020</time>
</div>
</div><!-- End recent post item-->
<div class="post-item">
<img src="<?php echo $baseUrl; ?>/themes/template3/assets/img/blog/blog-recent-4.jpg" alt="" class="flex-shrink-0">
<div>
<h4><a href="<?php echo $baseUrl; ?>/blog-details">Laborum corporis quo dara net para</a></h4>
<time datetime="2020-01-01">Jan 1, 2020</time>
</div>
</div><!-- End recent post item-->
<div class="post-item">
<img src="<?php echo $baseUrl; ?>/themes/template3/assets/img/blog/blog-recent-5.jpg" alt="" class="flex-shrink-0">
<div>
<h4><a href="<?php echo $baseUrl; ?>/blog-details">Et dolores corrupti quae illo quod dolor</a></h4>
<time datetime="2020-01-01">Jan 1, 2020</time>
</div>
</div><!-- End recent post item-->
</div><!--/Recent Posts Widget -->
</div>
</div>
</div>
</div>