Version 1.0 for CakePHP 2.x
Twitter Bootstrap is a sleek, intuitive and powerful front-end framework for faster and easier web-development. It comes accross with base HTML and CSS for typography, forms, buttons, tables, grids, navigation and more.
BootstrapCake is a plugin for CakePHP 2.x that easily integrates the Twitter Bootstrap CSS and JS toolkit.
Twitter Bootstrap GitHub Repo - The official Twitter Bootstrap Repository on GitHub
Twitter Bootstrap Website - Official Twitter Bootstrap Website with examples and tutorials
Introduction to Twitter Bootstrap - Introduction how to start with Twitter Bootstrap
-
Clone the plugin into your app/Plugin folder with
git clone [email protected]:visionred/BootstrapCake.git
-
Add
CakePlugin::load('BootstrapCake');
in yourbootstrap.php
under app/Config/bootstrap.php -
Setup your CakePHP Console (if you haven't already) following this guide
-
Switch to your console, run the following command (in your project path) and follow the guide:
cake BootstrapCake.install
-
Open your AppController.php under app/Controller and add a new helper:
class AppController extends Controller { public $helpers = array('BootstrapCake.Bootstrap'); }
Note: You can also load the helper in every other controller if you like. But it's recommended to in the AppController to make it always available.
-
Thats it! You're done and can now use Twitter Bootstrap in your CakePHP project!
BootstrapCake also brings an easy command line generator to create Twitter Bootstrap compatible layouts
Usage:
cake BootstrapCake.layout -n [LAYOUT_NAME] -t [*fixed or fluid]
Example:
cake BootstrapCake.layout -n my_layout -t fluid
This will generate a Bootstrap compatible and fluid layout under app/View/Layout/my_layout.ctp
The plugin includes a helper to load the required files for Twitter Bootstrap. So you are able to integrate Bootstrap in a existing layout.
Load all files:
echo $this->Bootstrap->load();
Creates and outputs the HTML tags for loading the CSS and JS files for Twitter Bootstrap.
Load CSS files:
echo $this->Bootstrap->css();
Outputs the HTML tag to just load the CSS files.
Load JS files:
echo $this->Bootstrap->js();
Outputs the HTML tag to just load the JS files.
By default the plugin loads always the compressed version of Twitter Bootstrap files to improve loading time. But sometimes you maybe want to choose the uncompressed dev file. You can switch for every helper method to the uncompressed file.
Usage:
echo $this->Bootstrap->load('dev');
- Extending helpers
- Automate updates to get always the current version of the framework
- Automate loading and enabling of helper in the app controller
Please feel free to contribute to the plugin with new issues, requests, unit tests and code fixes or new features. If you want to contribute some code, create a feature branch from develop, and send us your pull request. Unit tests for new features and issues detected are mandatory to keep quality high.
A big thanks to Twitter Bootstrap and all contributors for this awesome framework! http://twitter.github.com/bootstrap
BootstrapCake is licensed under the MIT License (http://www.opensource.org/licenses/mit-license.php)
Twitter Bootstrap is licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
Copyright (c) 2012 visionred