2014-07-28 09:52
浏览 50


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:

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

Here's my code in Controller:


    class Site extends CI_Controller {

    function __construct() {

    function index() {
        $config['full_tag_open']='<div id="pagination">';

        $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">
    点赞 评论