Integrating bootstrap into codeigniter

I have this on my $ CI route

$route['(:any)'] = 'main/index/$1';
$route['default_controller'] = 'main/index';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;

      

I also downloaded bootstrap theme from startbootstrap and I moved

css, fonts, images, js

To the root directory where the application folder is located

So the problem is that codeigniter is reading "css" as a controller, so the views cannot access the css.

I am also looking at a tutorial on how to integrate it. [Integrate Bootstrap Template into Code Learning Fundamentals for MVC Framework] [1]

From the moment he added the htaccess to the root directory, I keep on with this error,

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to fulfill your request.

Contact your server administrator at admin@example.com to inform them of when this error occurred and the steps you followed immediately before the error.

Additional information about this error may be available in the server error log.

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Contact your server administrator at admin@example.com to provide them with the time when this error occurred and what actions you took prior to this error.

Additional information about this error may be available when the server logs in error.

I am going through the comment section of this video and am trying to fix it, but I don’t want to do anything drastic as it could mess up my setup or any unwanted errors.

Or maybe there is another way to access the css from the view?

+3


source to share


1 answer


It's simple.

In the root directory, just create a folder /assets

where you can put folders /css', '/js', '/images

like this structure:

|- application
|- system
|- assets
    |- bootstrap
    |- css
    |- images
    |- js
    |- fonts

      

And in your view template, you can simply name your assets like this:

CSS

<link rel="stylesheet" href="assets/bootstrap/css/bootstrap.min.css">

      



JS scripts

<script src="assets/bootstrap/js/bootstrap.min.js"></script>

      

and you're done.

By the way, you just said that:

I also downloaded the boot theme from startbootstrap and I moved css, fonts, images, js In the root where the application folder is

I advise that it would be much better if you put it in one folder, which in this case is a folder /assets

, so it will be more organized.

+4


source







All Articles