php - 如何将 html 选项卡包含到分页器 cakephp 中

标签 php jquery html cakephp pagination

我正在使用 paginator cakephp 它工作正常但是,我有一个这样的菜单:

menu

所以分页在 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/

相关文章:

javascript - jquery 2.2 serializeArray() 在 Firefox、Chrome 中工作,但在 IE 中不起作用(11)

JavaScript 不显示任何警告对话框

javascript - 从另一个页面抓取 HTML

html - 当浏览器最小化时, float li 元素的格式不会扩展

php - 网站首页显示数据库高亮需要SQL

php - 如何用PHP函数删除一些单词?

php - 通过 PHP 在 "per-country/user preference"基础上分离 MySQL 内容

javascript - 当我单击div框时,音频无法播放

jquery - 无法使用 jQuery 设置颜色

php - nodeJS 初学者...使用 WAMP