dqls67891 2013-02-10 06:28
浏览 54
已采纳

如何在Codeigniter中隐藏分页类中的页面链接?

I am trying to achieve the following effect:

Prev 1 of 4 Next

I have tried setting the following $config option:

$config['num_links'] = 0;

But I get the following error:

Your number of links must be a positive number.

My config options are set as:

    $config['base_url'] = "/browse/tag/$tid/";
    $config['total_rows'] = $num_items;
    $config['per_page'] = $max_items;
    $config['first_link'] = FALSE;
    $config['last_link'] = FALSE;
    $config['uri_segment'] = 4;
    $config['use_page_numbers'] = TRUE;
    $config['display_pages'] = TRUE;
    $config['num_links'] = 0; # this doesn't work
    $config['prev_link'] = 'Previous';
    $config['next_link'] = 'Next';
    $config['cur_tag_open'] = '<span>';
    $config['cur_tag_close'] = " of $pages</span>";
    $config['full_tag_open'] = '<div class="previousnext">';
    $config['full_tag_close'] = '</div>';

If I change num_links to 1, I obviously get:

Prev 1 2 of 4 3 Next

And if I turn off display_pages I get:

Prev Next

At this stage, I would like to avoid modding core code.

  • 写回答

2条回答 默认 最新

  • doulangyu9636 2013-02-10 10:27
    关注

    If it's fine for you to have the digit links to exitst in HTML but not be displayed you may want to simply hide them using CSS.

    Use $config['num_tag_open'] to define an open tag with class, e.g.:

    $config['num_tag_open'] = '<div class="hidden">';
    

    And then simply add a CSS:

    .hidden { display: none; }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 划分vlan后不通了
  • ¥15 GDI处理通道视频时总是带有白色锯齿
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)
  • ¥15 自适应 AR 模型 参数估计Matlab程序
  • ¥100 角动量包络面如何用MATLAB绘制
  • ¥15 merge函数占用内存过大
  • ¥15 使用EMD去噪处理RML2016数据集时候的原理
  • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大