此代码有什么问题?
我有两个问题:
div
并排显示帖子和侧边栏时,我的页脚移到侧边栏中。所以,我无法解决问题:
<?php include 'includes/header.php'; ?>
<!--Start fluid container-------------------------------------------->
<div class="container-fluid mt-3">
<div class="row my-row">
<div class="card-deck">
<!--pagination-->
<?php
$per_page = 6;
if (isset($_GET["page"])){
$page = $_GET["page"];
} else {
$page=1;
}
$start_form = ($page-1) * $per_page;
?>
<!--pagination-->
<?php
$query = "select * from tbl_post limit $start_form, $per_page";
$post = $db->select($query);
if ($post) {
while ($result = $post->fetch_assoc()) {
?>
<div class="col-xs-12 col-sm-6 col-md-4">
<h2><a href="post.php?id=<?php echo $result['id']; ?>"><?php echo $result['title']; ?></a></h2>
<h4><?php echo $fm->formatDate($result['date']); ?>, by<a href="#"><?php echo $result['author']; ?></a></h4>
<a href="#"><img class="img-fluid" src="admin/upload/<?php echo $result['image']; ?>"
alt="Card image" style="width:100%"/></a>
<?php echo $fm->textShorten($result['body'], 200); ?>
<div class="readmore clear">
<a href="post.php?id=<?php echo $result['id']; ?>">ادامه مطلب</a>
</div>
</div>
<?php }?>
<!--end while loop-->
<!--pagination-->
<?php
$query = "select * from tbl_post";
$result = $db->select($query);
$total_rows = mysqli_num_rows($result);
$total_pages = ceil($total_rows/$per_page);
echo "<span class='pagination'><a href='index.php?page=1'>".'قبلی'."</a>";
for ($i=1; $i <= $total_pages; $i++) {
echo "<a href='index.php?page=".$i."'>".$i."</a>";
}
echo "<a href='index.php?page=$total_pages'>".'بعدی'."</a></span>"?>
<!--end pagination-->
<?php } else { header("location:404.php");} ?>
</div>
<?php include 'includes/sidebar.php'; ?>
</div>
</div>
<?php include 'includes/footer.php'; ?>
我很困惑。
我检查了所有div
,但无法解决问题。
我该怎么办?