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 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">
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染