CodeIgniter + Bootstrap集成 [英] CodeIgniter + Bootstrap integration

查看:115
本文介绍了CodeIgniter + Bootstrap集成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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?

推荐答案

bootstrap和codeigniter在一起很棒。另外,如果您的引导程序代码经常重复执行,则可以为其进行配置。例如,如果您有表单,并且正在使用codeigniter表单助手,则可以进行配置以同时处理引导程序代码和表单字段代码。使用引导页面上的快速示例 http://getbootstrap.com/css/#forms

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

那样,您可以使用纯PHP来完成表单,并且非常容易更改。

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

这篇关于CodeIgniter + Bootstrap集成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆