As our application grows, we'll want to be able to add our JavaScript into external files. Let's create a file called master.js
that will hold all of our application's JavaScript and then connect Bootstrap's JavaScript files that we downloaded in Chapter 6, Modeling Users.
1. Create a new file called
master.js
in thepublic/js
folder.2. Open the
layout.php
file, and add the following code right before the end of thebody
section:<script type="text/javascript" src= "//ajax.googleapis.com/ajax/libs/jquery /1.7.2/jquery.min.js"> <script type="text/javascript" src= "//ajax.googleapis.com/ajax/libs/jquery /1.7.2/jquery.min.js"> </script> <script type="text/javascript" src="<?php echo $this- >make_route('/js/bootstrap.min.js') ?>"> </script> <script type="text/javascript" src="<?php echo $this- >make_route('/js/master.js') ?>"> </script> </body> <...