php - 为什么 CodeIgniter-Bootstrap 仅在 frontepage.php 中加载,但在我看来却没有加载?

标签 php codeigniter twitter-bootstrap

当我去:

codeigniter/index.php Bootstrap 样式加载良好。实际上是来自

的内容

codeigniter/application/views/frontpage.php:

<div class="container">
   <div class="hero-unit">
      <h2>CodeIgniter Bootstrap</h2>
      <p>CodeIgniter Bootstrap kick starts the development process of the web development process by including Twitter Bootstrap into CodeIgniter. It also includes certain libraries such as AWS and Facebook in-case you are developing applications requiring those SDKs. So stop writing the same code over again and start working on your idea.</p>
      <a class="btn btn-primary btn-large" href="https://github.com/sjlu/CodeIgniter-Bootstrap">View on Github</a>
   </div>
</div>

问题是当我将相同的内容复制粘贴到我自己的文件中时

codeigniter/application/views/index.php

它无法正确加载。我的 Controller 如下所示:

<?php

class Cart extends CI_Controller {  

    function __construct()
    {
         parent::__construct();
         $this->load->model('cart_model'); // Load our cart model for our entire class
    }

    function index()
    {
        $data['products'] = $this->cart_model->retrieve_products(); // Retrieve an array with all products
        $data['content'] = 'products'; // Select our view file that will display our products
        $this->load->view('index', $data); // Display the page with the above defined content
    }

}
/* End of file cart.php */
/* Location: ./application/controllers/cart.php */

首页 Controller 是:

<?php if (!defined('BASEPATH')) die();
class Frontpage extends Main_Controller {

   public function index()
    {
      $this->load->view('include/header');
      $this->load->view('frontpage');
      $this->load->view('include/footer');
    }

}

/* End of file frontpage.php */
/* Location: ./application/controllers/frontpage.php */

最佳答案

一样使用base_url()
<link href="<?php echo base_url();?>assets/css/bootstrap.css" rel="stylesheet">

关于php - 为什么 CodeIgniter-Bootstrap 仅在 frontepage.php 中加载,但在我看来却没有加载?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22563658/

相关文章:

php - 检查重复的product_name PHP

php - 在php中查找数据库中的项目

php - Codeigniter 类似通配符

html - .icon .pull-left 表示奇怪的行为

Javascript 翻转带有内容的 div

javascript - Bootstrap 模式未在页面加载时显示

javascript - 下一个和上一个按钮表单流程的 HTML 表单验证

php - (403) 权限不足,无法在 gmail api 上发送电子邮件

php - 通过新认识的大型 PHP 应用程序调试我的方式并检测死代码的最佳方法?

php - 如何在codeigniter中使用mysql substring_index计算JSON格式数据的总和