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

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

问题描述

我对CodeIgnitor框架的理解是,它有助于通过视图和后端通过模型和控制器来简化创建应用程序前端的过程。是可能/容易/可接受使用的东西,如Bootstrap或一些其他前端框架,并与CodeIgnitor集成?使用框架构建前端独立于后端然后集成或同时构建它是有意义的吗?

My understanding of a framework like CodeIgnitor 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 CodeIgnitor? 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一起真棒。也如果你有bootstrap代码,经常重复,你可以为他们配置。例如,如果您有表单并且正在使用codeigniter表单帮助程序,您可以创建处理引导代码和表单字段代码的配置。使用引导页面中的快速示例 http://getbootstrap.com/css/#forms p>

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.

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

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