doufan6544
doufan6544
2014-07-28 09:52
浏览 50
已采纳

我的css没有正确使用codeIgniter显示

I'm trying to show css on my table using the codeigniter but it is not working. If I added the css at header part of my html, it works, but the problem is when I created a separate folder for css the design is not working. I do it correctly as I followed the example online.

Here's my code in View:

<html>
<head>
<title>No title</title>
<link rel="stylesheet" href=<?php echo base_url(); ?>"css/style.css" type="text/css" media="screen" charset="utf-8">
</head>
<body>
<div id="container">
    <h4> Super pagination with CodeIgniter</h4>
    <?php echo $this->table->generate($records); ?>
    <?php echo $this->pagination->create_links(); ?>
</div>
</body>
</html>

Here's my code in Controller:

    <?php

    class Site extends CI_Controller {

    function __construct() {
        parent::__construct();
    }

    function index() {
        $this->load->library('pagination');
        $this->load->library('table');
        $config['base_url']='http://localhost:81/nine/index.php/site/index';
        $config['total_rows']=$this->db->get('data')->num_rows();
        $config['per_page']=1;
        $config['num_links']=20;
        $config['full_tag_open']='<div id="pagination">';
        $config['full_tag_close']='</div>';

        $this->pagination->initialize($config);
        $data['records']=$this->db->get('data', $config['per_page'], $this->uri->segment(3));
        $this->load->view('site_view', $data);
    }
}

Here's the Autoload:

$autoload['libraries'] = array('database');
$autoload['helper'] = array('url');

Here's the Config

$config['base_url'] = 'http://localhost:81/nine/';

Here's the database

$db['default']['hostname'] = 'localhost';
$db['default']['username'] = 'root';
$db['default']['password'] = '';
$db['default']['database'] = 'datadb';

I don't know if the problem is on the version of the codeigniter. I'm using 2.2.0 while online is 1.7.2.

enter image description here

should be...

enter image description here

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • doushui3061
    doushui3061 2014-07-28 14:09
    已采纳

    Your stylesheet is incorrectly linked up (watch the double quotes after href):

    <link rel="stylesheet" href="<?php echo base_url(); ?>css/style.css">
    
    点赞 评论

相关推荐