0

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 Answer 1

2

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

<link rel="stylesheet" href="<?php echo base_url(); ?>css/style.css">
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.