 Hey everybody, it's Brian, and welcome to the 11th year tutorial. If you've been following along, we have teachers, students, and classes, and those are also database tables, and we're reading and writing out of the database through models. We've talked a little bit about model view controller architecture. I want to talk a little bit more about the views, specifically this little operations menu over to the right here. You notice how when you click on things, it changes. So like actually click here and you see we get more options, things like that. Well, how do we modify this list? I mean, what's really going on here? Because we have a little page that we're going to be playing around with called teacher slash test, but we want to get that in this list here. So how do we modify that? Where is this actually coming from? All right, let's open this up. Now, if you haven't been following along, let me digress here a little bit. In the teacher's controller, you're going to have to allow the test view and then make an actual action for the test and then render the test page. All right, so looking at the teacher's index, you'll see this menu right here. Remember how I said, you know, if you aren't very good at arrays in PHP, you're going to need to learn them because Yee is very array dependent. Almost everything in Yee boils down to an array at some point. This is a prime example. This menu array, and then we've got this create teachers and manage teachers, and you can see how it's got the label, my mouse work, label, and the URL. So the labels create teachers, the URLs create. So sure enough, if we go to the teacher's index, you've got create manage, and you can see if create goes to the teacher slash create route. So that's the menu right there. One of my little pet peeves about Yee, I understand why they did it this way, but I think they could have automated it a little better, is if you open some of these up, like let's actually go to admin, you'll see that it's different, meaning if you want to add a menu item to each one of these, you have to open each view and add it in manually. What a pain. Let me show you what I mean here. So we want to add our little test view in there. Call it test, and it's going to go to the test route. Now I should note right now that if you wanted to go to a different one, it would be controller slash and then whatever the view is, but we're in the same controller, so you don't need the controller. So we go here, and now we have the test on our index, and if you click it, sure enough, it goes to the teacher slash test. But notice how if you click create or manage, test suddenly goes away. What a pain. So we're going to just real quickly, through the magic of copy and paste, add that in. Now in case you're wondering why did they do it this way, well you notice how you have different operations. For example in the update.php, you can list create, view, and manage. Well sometimes you're going to need to be able to actually have an object. For example in update.php you'll see view teachers, URL, and then you're actually passing an array to the URL, which is the view, in this case view, we're just viewing the page, and the ID, which is the model ID teachers, or you could have just said primary key. So when you click on this, it's going to take you to the view, and it's going to have a query string of ID with the primary key, and let's demonstrate that real quick. Let's actually just click on Bob Smith here, yeah you see how it's right there. So if we click on that, go to update, this is where we actually were, and I don't know if you can see down in the status bar, it says teacher slash view ampersand ID equals seven, because that's the record ID right here. So if you click that, boom, we're going to go to teachers view, ampersand ID seven. So that is also how you would put a query string in there, pretty simple, it's just an array. Let's review it real quick again. The menu items, each one can have a label, a URL, and there's other properties we won't get into, but in the URL you can also tell it, you know, the view that you want to go to, in this case view, and the query string, and you can add other attributes in here too if you really wanted to. So now we've got the test link on just about every page that we click here, that's how you get it in there. Now you notice how when we go to test, there's nothing there, well how do we manipulate this? How do we get it to the other pages, the same layout? All right, so what we're going to do very simply is we're just going to say, copy this, go to, if I can find it, test PHP, and you should know, unless you're actually passing the model to this, you should actually get rid of that, simply because that turns it into a variable, and we're not passing a model to it, we're just rendering a static page, so let's actually get rid of some of these things here. Let's say we just want, yeah, index, and we shouldn't go to test because that's the current page. Now when we do that, ooh, what's up? Oh yes, see we're not passing the model here, so what we've got to do is go back in here, my bad, I fumbled a little bit, go back here, there we go, and we should actually change that title to test real quick just because I'm being that picky, if I can find my icon, there it is, test teachers, all right, so that is that, so one thing I also want to discuss while we're on the topic of layouts and we're talking about all this gobbly gook is what is really the difference between column one and column two, we touched about that briefly in a previous tutorial, let me close a bunch of these just to clean up some clutter here, if you go to, whoops, layouts, yeah, just views, layouts, you'll see column one, column two, main.php, open up main, we've done this before and this is our actual template for the every page, now there's column one, column two, what are really the distinctions here, well column one is if you're just using one column, column two is if there are two columns, all right, I know that wasn't very helpful, so let's go a little deeper into this, let's crank open our controller here, whoops, controller, you see how it says in the teacher's controller public layout equal slash slash layouts column two, what we're saying is by default we want two columns, now if we change that to column one just as demonstration, it'll default everything in teachers to one column, notice how boom our little operations menu disappeared, that's the power of layouts, I believe that's called a sub layout, our main layout is this page, you're seeing this beautiful web application we got going and our sub layout is in here, so let's actually go back, change this back to column two and there you go, now if we look at those individual layouts, you can see column one is just, you know, begin content and then it's loading the main layout, all of the beautiful web template that we got going on here and then it begins the content, the content of course would be the view and then it ends the view, whereas column two pretty much same thing, you're loading the main layout, but then you've got a couple other goodness in here, you've got the content and you've got just basically two divs, there's the first one and then here's the second one and notice the second one is a span five last, that's just our cascading style sheet and you can actually change the title here, so you can just, instead of operations we'll call it goodness and then items, this is the this menu, that's how it's getting that array out of the individual view, so if we go down to the index, see this menu right here, so you're just assigning a variable at that point, pretty simple, pretty easy to understand, whoops, and HTML option classes, you know, that's pretty much just setting the cascading style sheet, so you can change the way it looks, the way it functions, pretty neat huh, all right, so that in a nutshell is layouts and sub layouts and if you've been following along you should have a few items and teachers and now you have this beautiful test view