douhu8851
2014-02-26 18:20
浏览 96
已采纳

CodeIgniter + Bootstrap集成[关闭]

My understanding of a framework like CodeIgniter is that it helps streamline the process of creating an app's front end via views and backend via the models and controllers. Is it possible/easy/acceptable to use something such as Bootstrap or some other front end framework and integrate that with CodeIgniter? Does it make sense when using a framework to build the front end separately from the back end then integrate, or build them at the same time?

图片转代码服务由CSDN问答提供 功能建议

我对CodeIgniter这样的框架的理解是,它有助于简化通过视图和后端创建应用程序前端的过程 通过模型和控制器。 是否可以/容易/可接受使用诸如Bootstrap或其他前端框架之类的东西并将其与CodeIgniter集成? 使用框架与后端分开构建前端然后集成或同时构建它们是否有意义?

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

2条回答 默认 最新

  • dongyou8701 2014-02-26 20:26
    已采纳

    bootstrap and codeigniter are awesome together. also if you have bootstrap code that gets repeated often you can make configs for them. for example if you have forms and are using codeigniter form helpers you can make configs that handle both the bootstrap code and the form field code. Using a quick example from the bootstrap page http://getbootstrap.com/css/#forms

    // in your config
    $config['btformgroup'] = '<div class="form-group">';
    
    $config['emailfield'] = array(
    'name' => 'email',
    'class' => 'form-control', // Bootstrap specific 
    'id' => 'exampleInputEmail1', 
    'placeholder' = 'Enter email' );
    
    // in your form   
    echo $btformgroup . form_input($emailfield);
    
    // etc etc - can also include set_value(), error messages, closing divs...
    

    that way you can do your forms with pure php, and its very easy to change.

    打赏 评论
  • doudi5892 2014-02-26 18:48

    yea sure you can easily integrate bootstrap or any front end framework like smarty templating engine with codeigniter.

    打赏 评论

相关推荐 更多相似问题