0

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 styling

I use cakephp 2.10.11 How can i add bootstrap CDN ? or downloaded bootstrap library? where to put it? how to link to it?

Thanks : D

1
  • Read the documentation and use Google. Each point you ask for is covered in the according documentation. You haven't done anything at all on your own if you can't even figure out where to download Bootstrap. You just want to get spoon-feed. Commented Oct 23, 2018 at 12:08

2 Answers 2

2

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!

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks it was exacly what i was asking : )
@JakubUjvvary Welcome. Don't forget to accept the answer. It will help others
0

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.