Subversion Repositories SmartDukaan

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
12345 anikendra 1
# Twitter Bootstrap 2.0 for CakePHP
2
 
3
Version 1.0 for CakePHP 2.x 
4
 
5
Twitter Bootstrap is a sleek, intuitive and powerful front-end framework for faster and easier web-development. 
6
It comes accross with base HTML and CSS for typography, forms, buttons, tables, grids, navigation and more.
7
 
8
BootstrapCake is a plugin for CakePHP 2.x that easily integrates the Twitter Bootstrap CSS and JS toolkit. 
9
 
10
## Docs & Links 
11
 
12
[Twitter Bootstrap GitHub Repo](https://github.com/twitter/bootstrap "Twitter Bootstrap GitHub") - The official Twitter Bootstrap Repository on GitHub 
13
 
14
[Twitter Bootstrap Website](http://twitter.github.com/bootstrap/ "Twitter Bootstrap Website") - Official Twitter Bootstrap Website with examples and tutorials 
15
 
16
[Introduction to Twitter Bootstrap](http://twitter.github.com/bootstrap/getting-started.html "Introduction to Twitter Bootstrap") - Introduction how to start with Twitter Bootstrap 
17
 
18
## Installation & Setup
19
 
20
1. Clone the plugin into your _app/Plugin_ folder with `git clone git@github.com:visionred/BootstrapCake.git`
21
 
22
2. Add `CakePlugin::load('BootstrapCake');` in your `bootstrap.php` under _app/Config/bootstrap.php_
23
 
24
3. Setup your CakePHP Console (if you haven't already) following this [guide](http://book.cakephp.org/2.0/en/console-and-shells.html) 
25
 
26
4. Switch to your console, run the following command (in your project path) and follow the guide:
27
 
28
	```ruby
29
		cake BootstrapCake.install 
30
	```  
31
 
32
5. Open your _AppController.php_ under _app/Controller_ and add a new helper:
33
 
34
	```ruby
35
		class AppController extends Controller {
36
			public $helpers = array('BootstrapCake.Bootstrap'); 
37
		}
38
	```
39
 
40
	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. 
41
 
42
6. Thats it! You're done and can now use Twitter Bootstrap in your CakePHP project! 
43
 
44
## Layout Generator 
45
 
46
##### BootstrapCake also brings an easy command line generator to create Twitter Bootstrap compatible layouts
47
 
48
Usage:
49
 
50
```ruby
51
	cake BootstrapCake.layout -n [LAYOUT_NAME] -t [*fixed or fluid] 	
52
```
53
 
54
Example:
55
 
56
```ruby
57
	cake BootstrapCake.layout -n my_layout -t fluid 
58
```
59
 
60
This will generate a Bootstrap compatible and fluid layout under _app/View/Layout/my_layout.ctp_
61
 
62
## Helper
63
 
64
The plugin includes a helper to load the required files for Twitter Bootstrap. 
65
So you are able to integrate Bootstrap in a existing layout.  
66
 
67
Load all files: 
68
 
69
```ruby
70
	echo $this->Bootstrap->load();
71
```
72
 
73
Creates and outputs the HTML tags for loading the CSS and JS files for Twitter Bootstrap.
74
 
75
Load CSS files:
76
 
77
```ruby
78
	echo $this->Bootstrap->css();
79
```
80
 
81
Outputs the HTML tag to just load the CSS files. 
82
 
83
Load JS files:
84
 
85
```ruby
86
	echo $this->Bootstrap->js(); 
87
```
88
 
89
Outputs the HTML tag to just load the JS files. 
90
 
91
###### Choose between compressed and uncompressed version
92
 
93
By default the plugin loads always the compressed version of Twitter Bootstrap files to improve loading time. 
94
But sometimes you maybe want to choose the uncompressed dev file. You can switch for every helper method to the uncompressed file.
95
 
96
Usage:
97
 
98
```ruby
99
	echo $this->Bootstrap->load('dev');
100
```
101
 
102
## Patches & Forks
103
 
104
### Updates for the future 
105
 
106
<ul>
107
	<li>Extending helpers</li>
108
	<li>Automate updates to get always the current version of the framework</li>
109
	<li>Automate loading and enabling of helper in the app controller</li>
110
</ul> 
111
 
112
## Contributing to this Plugin 
113
 
114
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. 
115
 
116
## Thanks
117
 
118
A big thanks to Twitter Bootstrap and all contributors for this awesome framework! http://twitter.github.com/bootstrap
119
 
120
## License 
121
 
122
BootstrapCake is licensed under the MIT License (http://www.opensource.org/licenses/mit-license.php)
123
 
124
Twitter Bootstrap is licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
125
 
126
## Copyright 
127
 
128
Copyright (c) 2012 visionred
129
 
130