当我在产品列表中,并尝试使用分页按钮移动到另一个页面时,它会触发404not Found错误。这是由于错误的路由,我无法解决。当前分页为:
localhost/my_store/index.php?route=product/category&page=1
如果我手动将其更改为:
localhost/my_store/index.php?route=product/all&page=1
它工作得很好。我检查了我的分页脚本,但我不知道要传递给URL的参数是什么:
for ($i = $start; $i <= $end; $i++) {
if ($page == $i) {
$output .= '<li class="active"><span>' . $i . '</span></li>';
} else {
$output .= '<li><a href="' . str_replace('{page}', $i, $this->url) . '">' . $i . '</a></li>';
}
}完整代码片段:http://pastebin.com/3fSECkPG
如何修复我的分页路由?
发布于 2016-05-02 06:30:28
我设法通过在我的Products Controller (在目录/controller/product/all.php中找到)更改我的分页路由来修复它。搜索您的分页路由变量,并将其更改为与您的产品页面列表匹配(我的是前面提到的all.php ):
目录/控制器/产品/all.php
$pagination->url = $this->url->link('product/all', 'page={page}');如果有人知道解决这个问题的更好和适当的方法,我非常感谢。
https://stackoverflow.com/questions/36972502
复制相似问题