Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have developed website using CodeIgniter that uses MySQL to populate a results page. I would now like to improve all the pages appearances and most places recommend using Bootstrap. I have tried to add Bootstrap to my CodeIgniter project but with no success.

Does anyone know of an up-to-date guide I could follow to complete this?

Thanks

share|improve this question
 
github.com/sjlu/CodeIgniter-Bootstrap –  Bora Dec 30 '13 at 16:19
add comment

1 Answer

A simple way would be to use Bootstrap CDN. For CSS, simply include this line in the <head> section of every webpage (somewhere in your view files, depending on how you have structured them):

<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.3/css/bootstrap.min.css" rel="stylesheet">

To include the JavaScript:

<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>

Bootstrap's plugins depend on jQuery, so you'll need to include jQuery before Bootstrap's JavaScript.

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>

Alternatively you could host the files on your web server. Upload the relevant files to a publicly accessible directory. I'm going to assume that they are in an assets folder, in your web root, like this:

- public_html
  - index.php
  - assets
    - css
      - boostrap.css
    - js
      - bootstrap.js
      - jquery.js
  (other files/directories...)

To include them in your view files, you can link them like this:

<link rel="stylesheet" href="<?php echo base_url("assets/css/bootstrap.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.js"); ?>"></script>

You'll need to have loaded the URL Helper to use the base_url() function.

share|improve this answer
 
i have included them (if i click them in chrome web inspector i go too the right file) but i cant get my dropdown menu to dropdown. copied 10 diffrent ones so im sure its not the html –  Sven B Mar 13 at 22:53
 
The dropdowns function using a jQuery plugin. Have you included jQuery? –  Lefters Mar 14 at 5:41
 
thanks i forgot to include jquery –  Sven B Mar 14 at 9:33
 
No worries, I've edited the answer to show that jQuery is required. –  Lefters Mar 14 at 9:43
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.