0

I am new to Codeigniter and also to Bootstrap so when I tried to put the two together and also jQuery a problem arised. I have the following structure:

  • Views/Layout/content.php
  • Views/home_view.php
  • Controllers/home.php
  • .htaccess

with the following coding: Views/Layout/content.php:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Doc</title>
<link rel="sylesheet" href="<?php echo base_url("assets/css/bootstrap.min.css");?>">    
<script type="text/javascript" src="<?php echo base_url("assets/js/jquery.js");?>"></script>
<script type="text/javascript"  src="<?php echo base_url("assets/js/bootstrap.min.js");?>"></script>

</head>
<body>

<div class="container">

 <div class="col-xs-6">


 </div>

 <div class="col-xs-6">

  <?php $this->load->view($content_view); ?>

 </div>
</div>
</body>
</html>

Views/home_view.php:

<h1>Hello </h1> <h2>Content goes here </h2>

Controllers/home.php:

class Home extends CI_Controller{

  public function index(){

   $data['content_view']="home_view";

   $this->load->view('Layout/content',$data);

   $this->load->helper('url');

  }

}

.htaccess:

    RewriteEngine on
    RewriteCond $1 !^(index\.php|images|assets|robots\.txt)
    RewriteRule ^(.*)$ index.php/$1 [L]

The above and below coding includes everything relevant I could find on other Stackoverflow posts, Codeigniter documentation and also other web pages. Lastly, I also made the following changes to application/config.php:

$config['base_url'] = 'http://localhost/project/';
$config['index_page'] = '';

When I open the home page in the browser, the text is displayed normally (without any font/aligning changes - as it would have been if bootstrap was enforced). Moreover, I checked with Inspect element/View page source and neither Safari nor Google Chrome display anything to let me know that the files are not working. I downloaded the latest versions from jQuery (2.1.4) and Bootstrap (3.3.5). What other code/setting must I change in order to view the Bootstrap/jQuery implemented and the home.php text displayed accordingly in browser?

Thank you very much in advance for your help!

2
  • Read this tutorial w3code.in/2015/10/… Commented Oct 16, 2015 at 7:22
  • Yes, this was the mistake.."sylesheet" instead of the right "stylesheet". Thank you Commented Oct 16, 2015 at 9:28

1 Answer 1

2

Change this

<link rel="sylesheet" href="<?php echo base_url("assets/css/bootstrap.min.css");?>"> 

to

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

2 Comments

The both statements seem to be the same...maybe you skipped to make the change on the second or am I missing something...thanks.
you type rel="sylesheet" instead of rel="stylesheet"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.