我正在使用 paginator cakephp 它工作正常但是,我有一个这样的菜单:
所以分页在 tab-2
中,当我单击下一步重新加载页面并自动转到 tab-1 时,有一个解决方案可以让它继续转到 tab-2 ??
我尝试使用 projectURL#tab-2
但仍然无法正常工作
这是 Controller 代码:
$this->Paginator->settings = array(
'conditions' => array('user2' => $userId),
'order' => array('Message.timestamp' => 'DESC'),
'recursive' => 2 ,
'limit' => 8
);
// similaire à un findAll(), mais récupère les résultats paginés
$message = $this->Paginator->paginate('Message');
这是 View 代码:
<?php foreach ($message as $recep){ ...} ?>
<ul class="pagination" style="margin-left: 25%; margin-top: 2%;">
<?php
echo $this->Paginator->prev(__('précédent'), array('tag' => 'li'), null, array('tag' => 'li','class' => 'disabled','disabledTag' => 'a'));
echo $this->Paginator->numbers(array('separator' => '','currentTag' => 'a', 'currentClass' => 'active','tag' => 'li','first' => 1));
echo $this->Paginator->next(__('suivant'), array('tag' => 'li','currentClass' => 'disabled'), null, array('tag' => 'li','class' => 'disabled','disabledTag' => 'a'));
?>
最佳答案
如果您还向页面添加了一些 javascript,那么您使用 url#hash 的方法应该可行:
window.onload = function() {
if (window.location.hash) { //A hash exists in the url
var hash = window.location.hash; //Now has the #hash part of the url
//Code to open the tab here
}
}
关于php - 如何将 html 选项卡包含到分页器 cakephp 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40809710/