0

I'm trying to add bootstrap to a cakephp site. I added bootstrap js/css's in default.ctp and I want to use some glyphicons in buttons, but the request for the fonts (.ttf) fails (404). I have them in /app/webroot/fonts.

Apparently cake is interpreting that I want to use a controller named fonts, when I do the request from the address bar I get:

Missing Controller Error: FontsController could not be found.

Error: Create the class FontsController below in file: app\Controller\FontsController.php

How do I bypass this so the font file is downloaded?

This is what I've done: 1) Add bootstrap to default.ctp

<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/bootbox.min.js"></script>

2) Create a button with a glyphicon in a index.ctp:

<button type="button" class="btn btn-info" aria-label="Left Align">
  <span class="glyphicon glyphicon glyphicon-list-alt" aria-hidden="true"></span>Add
</button>
  • Where is the code u tried? – Michel Jul 16 '15 at 06:39
  • Think this is about Cake not finding the files. Is your fonts directory as the same level as your css and js directories - see this answer: http://stackoverflow.com/questions/19608873/how-to-include-glyphicons-in-bootstrap-3 . Might be worth trying the HtmlHelper ($this->Html->script() and $this->Html->css() to write those and – theotherdy Jul 16 '15 at 16:02
  • Yes, the fonts directory is at the same level as css/js. I'm going to try using the helper, thanks – Raul Verdesia Jul 16 '15 at 16:39

1 Answers1

0

You could try to load bootstrap this way :

echo $this->Html->css('bootstrap');
echo $this->Html->script('bootstrap');