Anybody has integrated cake php with bootstrap framework/css style ?
I want to be able use advantages of bootstrap in cakephp views : like btn\'s and panels bootstrap s
Download bootstrap css and js files and put them in webroot/css or webroot/js respectively.
Then in app/View/Elements/header.ctp
file add
<link rel="stylesheet" href="<?php echo Router::url('/css/bootstrap.min.css', true); ?>">
<link href="https://stackpath.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
And in app/View/Elements/footer.ctp
add
<script type="text/javascript" src="<?php echo Router::url('/js/bootstrap.min.js', true); ?>"></script>
Now you can access bootstrap classes in your code.
If you want to use downloaded bootstrap library. Just put your bootstrap.min.css
file inside /app/webroot/css/
folder.
app/
webroot/
css/ <-- here
and then use it like below using HtmlHelper
<?php echo $this->Html->css("bootstrap.min.css"); ?>
OR
If you want to use cdn the just add the below code inside head tag of .ctp file
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
Cakephp 2.x -> HtmlHelper
Hope this will help!