codeigniter的分页css无法正常工作

时间:2013-03-24 13:44:14

标签: css codeigniter pagination

注意:我刚刚意识到我的CSS出了问题,浏览器只能查看我的旧CSS(意味着我无法编辑我的CSS)。怎么了?

我尝试按照tutorial进行操作,但我不会像视频那样做同样的事情。

我想修改pagination个链接的外观(使用codeigniter)。这是控制器代码:

//pagination
    $config['base_url'] = site_url('/backend/umat/');
    //$config['base_url'] ='http://localhost/ci_gabdb/index.php/backend/umat/';
    $config['total_rows'] = $this->backend_m->count_umat();
    $config['per_page'] = 10; 
    $config['uri_segment'] = 3;
    $config['full_tag_open'] = '<div id="pagination">';
    $config['full_tag_close'] = '</div>';

    $this->pagination->initialize($config); 

    $data['pagination'] = $this->pagination->create_links();

请注意,我已使用full_tag_openfull_tag_close。我还尝试在html中手动插入<div>标记,但它们都没有工作。

这是我的css代码:

#pagination a {
    font-family: Tahoma, Geneva, sans-serif;
    font-size: 10px;
    color: #292929;
    text-decoration: none;
    background: #e3e3e3;
    border: 1px solid #000;
    padding: 4px 7px;
}

我认为分页css应该正常工作,但事实并非如此。我的错误在哪里?谢谢:D

2 个答案:

答案 0 :(得分:3)

这就是我正在使用的:

    // pagination code
    $config = array();
    $config["base_url"] = base_url() . "/themes/all";
    $config["total_rows"] = $this->auth_model->record_count();
    $config["per_page"] = 30;
    $config["uri_segment"] = 3;
    $choice = $config["total_rows"] / $config["per_page"];
    $config["num_links"] = round($choice);
    $config['full_tag_open'] = '<div class="pagination pagination-large"><ul>';
    $config['full_tag_close'] = '</ul></div>';
    $config['first_link'] = false;
    $config['last_link'] = false;
    $config['first_tag_open'] = '<li>';
    $config['first_tag_close'] = '</li>';
    $config['prev_link'] = '«';
    $config['prev_tag_open'] = '<li class="prev">';
    $config['prev_tag_close'] = '</li>';
    $config['next_link'] = '»';
    $config['next_tag_open'] = '<li>';
    $config['next_tag_close'] = '</li>';
    $config['last_tag_open'] = '<li>';
    $config['last_tag_close'] = '</li>';
    $config['cur_tag_open'] =  '<li class="active"><a href="#">';
    $config['cur_tag_close'] = '</a></li>';
    $config['num_tag_open'] = '<li>';
    $config['num_tag_close'] = '</li>';

    $this->pagination->initialize($config);

    $page = ($this->uri->segment(3)) ? $this->uri->segment(3) : 0;
    $data["themes"] = $this->auth_model->fetch_themes_total($config["per_page"], $page);
    $data["links"] = $this->pagination->create_links();
    // pagination ends here

答案 1 :(得分:1)

您所拥有的是浏览器缓存问题。有几种解决方案,在任何浏览器中按CTRL + F5几次都会强制刷新网站。还有其他方法可以强制刷新CSS。一种是在代码中为CSS添加一个查询字符串,我在开发中使用的是:

   <link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>assets/css/main.css?time=<?php echo filemtime('./assets/css/main.css');?>" />

这样做是用查询字符串附加css的结尾并随时间变化,所以每次加载页面时我的浏览器都会认为它是新版本的CSS并重新加载它。

您还可以告诉您的浏览器在每次访问时重新加载整个页面,此设置在所有浏览器中都有所不同,但在Chrome浏览器中

设置&gt;高级设置&gt;更改代理服务器设置&gt; “一般标签”&gt;浏览器历史记录设置&gt;每次加载网页时,临时Internet文件都会更改单选按钮。