当前位置: 动力学知识库 > 问答 > 编程问答 >

php - Integrating bootstrap to codeigniter

问题描述:

I have this on my $route on CI

$route['(:any)'] = 'main/index/$1';

$route['default_controller'] = 'main/index';

$route['404_override'] = '';

$route['translate_uri_dashes'] = FALSE;

I also downloaded a bootstrap theme from startbootstrap and i moved

css, fonts, images, js

Into the root,where application folder resides

So the problem is that codeigniter reads 'css' as a controller so the views can't access the css.

I am also watching a tutorial on how to integrate it.

[Integrate a Bootstrap Template into Code Igniter Learning Basics of MVC Frameworks][1]

From the point where he added htaccess on the root i keep having this error,

Internal Server Error

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

Please contact the server administrator at [email protected] to inform them of the time this error occurred, and the actions you performed just before this error.

More 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.

Please contact the server administrator at [email protected] to inform

them of the time this error occurred, and the actions you performed

just before this error.

More information about this error may be available in the server error

log.

I am searching through the comment section of that video and am trying to remedy it but i don't wanna do anything drastic since it may ruin my set up or any unwanted errors.

Or perhaps is there any other way i can access the css from the view?

网友答案:

It's simple.

In your root directory, just create an /assets folder where you can put /css', '/js', '/images folders like this structure:

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

And in your view template you can just call 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.

Btw, you just said that:

I also downloaded a bootstrap theme from startbootstrap and i moved css, fonts, images, js Into the root, where application folder resides

I advise that it would be much better if you put it on one folder, which in this case is /assets folder, so it would be more organized.

分享给朋友:
您可能感兴趣的文章:
随机阅读: