1 00:00:00,780 --> 00:00:04,330 I hope you enjoyed exploring your magical powers so far. 2 00:00:04,330 --> 00:00:07,230 In the words of Terry Pratchett, it's still magic, 3 00:00:07,230 --> 00:00:09,210 even if you know how it's done. 4 00:00:09,210 --> 00:00:10,860 We still have more to learn. 5 00:00:10,860 --> 00:00:14,590 In the next section, we'll be grouping our objects into collections 6 00:00:14,590 --> 00:00:17,100 by creating a cookbook for our recipes. 7 00:00:17,100 --> 00:00:20,120 To do that, we'll need some recipes to work with. 8 00:00:20,120 --> 00:00:23,070 Plus, I promised you some of my own recipes. 9 00:00:23,070 --> 00:00:25,980 So how do we load up a bunch of recipe objects? 10 00:00:27,540 --> 00:00:30,380 There are many different ways to load these recipes or 11 00:00:30,380 --> 00:00:32,490 any other data into our program. 12 00:00:32,490 --> 00:00:36,610 Most likely, you would want to use some sort of database or 13 00:00:36,610 --> 00:00:39,780 pull from a json feed or something similar. 14 00:00:39,780 --> 00:00:44,310 Data storage and feeds are more than we need to get into in this course. 15 00:00:44,310 --> 00:00:48,450 So instead I set everything up for you in a single recipe.php file. 16 00:00:49,790 --> 00:00:52,100 Grab that file from the download section, and 17 00:00:52,100 --> 00:00:54,160 let's get some recipes loaded into the project. 18 00:00:55,940 --> 00:00:57,660 We want to stay organized. 19 00:00:57,660 --> 00:01:01,360 Since this is a helper file, we want to put it in a new folder. 20 00:01:01,360 --> 00:01:03,888 So let's add a new folder called inc. 21 00:01:06,784 --> 00:01:08,440 This is short for include. 22 00:01:09,450 --> 00:01:12,250 Then we'll upload the recipes.php file. 23 00:01:17,382 --> 00:01:19,130 Let's take a look at this recipes file. 24 00:01:21,420 --> 00:01:26,240 At the top, I've included a DocBlock comment area that gives you some notes, 25 00:01:26,240 --> 00:01:29,690 as well as a list of all the recipes in this file. 26 00:01:29,690 --> 00:01:30,980 You can scroll down and 27 00:01:30,980 --> 00:01:34,080 see these recipes have been added just like we added recipe1. 28 00:01:34,080 --> 00:01:38,110 You're welcome to add your own recipes to this file as well. 29 00:01:39,140 --> 00:01:42,294 Let's load these recipes into our project. 30 00:01:42,294 --> 00:01:45,620 Back in cookbook.php, we'll add a new include. 31 00:01:53,200 --> 00:01:56,399 And voila, you have a bunch of recipes ready to use. 32 00:01:57,400 --> 00:01:59,557 Let's clean up the recipes from this file and 33 00:01:59,557 --> 00:02:02,410 display one of the full recipes from this new file instead. 34 00:02:15,072 --> 00:02:16,469 Now let's run this script. 35 00:02:23,821 --> 00:02:27,230 Great, we see our Belgian waffle recipe by Alena Holligan. 36 00:02:28,770 --> 00:02:31,550 All this work is making me hungry but 37 00:02:31,550 --> 00:02:34,280 we're not quite ready to start cooking yet. 38 00:02:34,280 --> 00:02:35,640 You're doing great. 39 00:02:35,640 --> 00:02:40,600 We have a recipe class and all our recipe objects loaded. 40 00:02:40,600 --> 00:02:45,770 We have a render class for rendering our recipes in the desired formats, and 41 00:02:45,770 --> 00:02:47,800 we've taken on the role of magician. 42 00:02:47,800 --> 00:02:49,750 That's quite the accomplishment. 43 00:02:49,750 --> 00:02:53,780 At this point our recipes are basically a random stack of cards. 44 00:02:53,780 --> 00:02:58,160 That makes it really hard to find anything we actually want, or 45 00:02:58,160 --> 00:03:00,090 even to know what we have. 46 00:03:00,090 --> 00:03:03,390 In the next section, we'll create a collection of objects 47 00:03:03,390 --> 00:03:06,410 that can help us organize and make use of these recipes. 48 00:03:07,520 --> 00:03:11,429 Man does not live on coding alone, so take a break and recharge. 49 00:03:11,429 --> 00:03:14,760 But hurry back, I'm excited to show you my cookbook collection.