dtrvzd1171
2015-05-15 04:47 阅读 130
已采纳

将bootstrap集成到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 admin@example.com 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 admin@example.com 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?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • 已采纳
    dougou8552 dougou8552 2015-05-15 05:27

    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.

    点赞 1 评论 复制链接分享

相关推荐