【发布时间】:2025-12-09 12:55:01
【问题描述】:
一定要把问题说清楚,说清楚让我详细说明;我需要实现的是我有一个分页正在向前工作的页面,当我对页面进行分页时,页面会转到页面顶部,因为它确实刷新了,但我需要它留在分页链接的 div处于。分页内容所在的内容区域,可能看起来页面没有加载,只有内容被更新。 一定要明白这一点。
代码如下:
<div class="large-12 columns" id="paginate" style="border-right: 1px solid #E3E5E8; height: 572px;">
<article>
<hr><div class="row">
<div class="large-6 columns">
<?php
//stories complete do not edit.
foreach($stories as $story){
echo '
<p>'.$this->Html->image($story['image'].'.jpg', ['alt'=>'image for article']).'</p>
</div>
<div class="large-6 columns">
<h5><a href="#">'.$story['title'].'</a></h5>
<p>
<span><i class="fi-torso"> Creator: '.$story['creator'].' </i></span>
<span><i class="fi-calendar"> '.$story['created'].' </i></span>
</p>
<p>'.$story['story'].'</p>';
//same place after pagination
//
}
?>
</div>
<div style="padding: 2px;float: left;margin-top: 31%;margin-left: -1206px;">
<ul class="pagination" role="navigation" aria-label="Pagination">
<li><?php echo $this->Paginator->prev(' < ' . __(''));?></li>
<li><?php echo $this->Paginator->numbers();?></li>
<li><?php echo $this->Paginator->next(' > ' . __(''));?></li>
</ul>
</div>
</div><hr>
</article>
</div>
根据代码和早期的 Cakephp 代码,我们能够使用分页器添加到 div 的链接,它会将我们直接带到特定的 div,我无法弄清楚使用 cakephp-4.x 执行此操作的语法所以善待并以最少的代码提供最佳解决方案。
【问题讨论】:
标签: php html css zurb-foundation cakephp-4.x