William Rosener: Hello, Dr. Bill, welcome back. And this video you'll learn how to include other files of all the topics covered in this class. In my opinion, this is the most important topic.
William Rosener: When it comes to rapid application development, nothing will save you more time the learning how to include files.
William Rosener: Personally, of all the websites have ever worked on over the years, you will find out might have the same content displayed a numerous locations.
William Rosener: But rarely do I need to modify more than one document to have this content changed. Let's start by taking a look at what you learn how to create here in this video.
William Rosener: So at the very top, we're going to have a header just going to say your company name will have some hyperlinks here and
William Rosener: Then we'll go ahead and have some text here, Alabama, insert an image will grab some information.
William Rosener: Display some information. I just grabbed this right from my Wikipedia and then we'll have a footer. Let's go ahead and take a look.
William Rosener: At Alaska, exact same thing. We're going to have a consistent header an image for Alaska some text and footer. And the same thing with Arizona header image some text and a photo.
William Rosener: Let's go ahead and take a look at this information. Here's a footer, just some a couple lines of code here three lines of code their company name, email, and a phone number.
William Rosener: Here is a header just your company name. We got some this probably should be buttons or just make this video, nice and short and simple, just got some hypertext references, they're
William Rosener: Almost going to go ahead and give you this information here state information on they have you I've given you four three states, I may have you do for four or five states, sir. So here's Alabama.
William Rosener: Just some data. I grabbed right off Wikipedia. Don't feel. And in this case, I would not feel that any violation of academic misconduct there if you just grab some information right off the web there. Here's a picture of Alabama.
William Rosener: Here's the Alaska, I grant is grab this right off Wikipedia, just to illustrate this exercise. Here's an image. Here's Arizona and finally an image of Arizona them.
William Rosener: Okay, so we'll take a look here, let's kind of get started. The very first step we're going to do is we're going to go ahead and work on a header.
William Rosener: Then we'll work on a footer and then we'll start working on the rest of this information. So let's go ahead and start off with our header.
William Rosener: I'm just going to go ahead and grab a little code here and pasted. So here's our head of tea or header. I just got a header to tag start it, close it your company name. Why don't you go ahead and put your own name in here.
William Rosener: And then here, what of God has some hypertext references. So I've got a for anchor hypertext reference sequel. I've got a URL tell you I'm gonna go ahead and put my own URL in here.
William Rosener: Okay, so when I press on the home, it would take me to Bill Gross calm here at the end, there's just a non breaking space.
William Rosener: And I've got three more hypertext references and feel free to have those go to someplace else. If you want them. Okay, let's go ahead and say that I'm going to go to File, Save As. I'll be saved mine on a folder called a temp and I'm just going to call this one header dot HTML.
William Rosener: And I know where I'm saving it. And it's a text document header dot HTML and I'm gonna hit save. Okay, at this point, I'm just going to come right up here to File, New, and now we'll go ahead and work on our footer.
William Rosener: Okay, I'm for the footer. I'm just gonna have a couple line breaks. I've got the company name again, feel free to put your name in there. I've got an
William Rosener: Imaginary email address and phone and if you want. Once you change the police one of those so that when you go through this exercise, you know that you're looking at your own data and not mine. Okay, let's go ahead and I say this, I'm going to File, Save As.
William Rosener: And I'm going to call this one footer.
William Rosener: dot HTML and I'm gonna go ahead and save that.
William Rosener: So, pause. Take a look here. We just got done created footer and header and I'll give you a state information there.
William Rosener: Okay, let's go ahead and come right up here. I'm not going to go to File, New, and we're going to go ahead and start off with Alabama.
William Rosener: That's it. Well, let me just sell this throw a little header tag in here for Alabama.
William Rosener: Okay. Just take a look here. So far, we've got
William Rosener: hypertext I mean HTML HyperText Markup Language. I'm gonna close it started my head. Close the head title. Title code Alabama start the body, close the body in here is Alabama. Let's just do a little bit more before we save it. Let me just go ahead and grab
William Rosener: The header. So I'm working on, Alabama. But what I'm going to do is I'm going to include header dot HTML. And in this case, it has to be in the same directory as the fall. We're working on
William Rosener: I'll show you here in a moment. All I typically do but so let's just go ahead and close it and make it really simple there, it's going to assume we're assuming it's in the same folder as this fall. So it's come right up here. I'm going to come to file. I'm gonna go to save as
William Rosener: This one, it's going to be Alabama.
William Rosener: dot PHP text document there and make sure you should be saving all in the same area there and hit Save.
William Rosener: Okay, at this point, let's go ahead and there it is. Let's go ahead and upload something start checking this. So the very first step I do is come over here. I'm going to right click and I'm going to create a directory
William Rosener: And whoops I need to come up here. Right click on right up here where it says Instructor Right Click Create directory. And I'm going to call this one.
William Rosener: Assignment.
William Rosener: Six and then hit okay.
William Rosener: And I'll tell you what I am going to go ahead and transfer this information. Let me hit refresh here just to make. I wanted to make sure this information is popping up here and
William Rosener: I could simply take this and transfer it over. But let me show you what you most likely to be doing is I'm gonna double click on assignment six. I'm now going to right click, I'm going to create a directory
William Rosener: I'm going to call this state information.
William Rosener: Okay and I'm gonna hit OK. So within
William Rosener: Assignment six. I've got a folder called state information. And I'm going to go into there. I'm gonna come over here and I'm going to take the six files and upload them.
William Rosener: Okay, so here's state information I got Alabama data dot txt Alabama jpg Alaska data, Alaska, the image, etc. There. Okay, let me come back up here.
William Rosener: And I'm going to come back up a level over here as well.
William Rosener: Okay, now I'm gonna go ahead and upload these three files.
William Rosener: And yes, I could have done this all at once. But in your case, I'm not sure if you had
William Rosener: Just kind of walk you through how to create a directory for state of Commission there. Okay, let's go ahead and take a look at this. I'm going to take a look here. I'm into the structure and hit refresh.
William Rosener: On hit assignment six and here we are. Let me do this first. First of all, it will take a look at the footer HTML, here it is. Here's header.
William Rosener: And here's our state information. It's a folder. But then when it's contains Alabama data.
William Rosener: Alabama, the image and so forth there. Okay, let's go ahead and actually click on Alabama dot PHP and we'll take a look at what has happened here.
William Rosener: So, so far, we've got we're including the header in my case here, if I clicked on home. It would actually go to my homepage there and you're, you may have to implement this. Or maybe not. And I've got the word Alabama, so. So next step is to listen search the footer.
William Rosener: And again, as I mentioned, I am. I'll tell you what, let me go ahead and let me do that first here. For those of you that are
William Rosener: hosting your data on Bill roaster calm. I'm gonna go ahead and delete this and show you
William Rosener: Okay, what I just had their assumed
William Rosener: That header was in the current location. This is what I typically do. So it's going to look for header in the root directory. So even if I'm two three levels deep, it's still going to find my header somebody go ahead and I'll say this.
William Rosener: Upload it
William Rosener: I'm going to take a look at it.
William Rosener: And sure enough, I can see the background. I'VE GOT BOO roesner the PhD, all of this information has now been included there. So that's only going to work. Obviously if you're on my account their bill wrestler.com there so I'm gonna put back to where we were here.
William Rosener: Okay. And again, just to make this simple. We are going to go ahead and assume
William Rosener: That the header isn't the same directory as this case Alabama dot PHP there.
William Rosener: Okay, so now taking a look, we're going to include the header. I've just got some Alabama and I'm gonna include the footer. So let's go ahead and save that.
William Rosener: And we'll go ahead and upload it.
William Rosener: And we'll take a look and see what it looks like and great. So this is our header information, it will be working here some more. And then we've got our footer. And again, the here. Hopefully you guys realize what's going on here. If I'm
William Rosener: If tomorrow. I want to modify the footer have some additional information or maybe change the phone number, the email address. I don't have to modify 50 documents. I just have to modify one document, since it's getting included and all, as so many did all 50 states there.
William Rosener: Okay. Does anyone. One last thing before I get going back there. Here it is.
William Rosener: I'm using a lot of times in my videos, or I may use Word Pad Notepad just because it's very clean and
William Rosener: Not even sure what else but that's kind of what I typically use the videos but at some point you're going to definitely want to probably look into an editor, like Notepad plus plus, which is open source and free
William Rosener: Where you get your line numbers. So if you're running your code and you get a line on 500
William Rosener: At that point, you definitely something like notepad plus plus, where you've got your line number you just scroll to line 500 out there it is. And then you can fix it. Be very tedious to try and do that, and then just notepad.
William Rosener: Okay, so let's go ahead and now we're going to start working on some of information now right down here.
William Rosener: Okay, and what we're going to do is have this information, fill in. But we're not even when I
William Rosener: When I want to create the next day. I'm just gonna have to make two little changes. I'm not going to have to make any changes down here and I'm going to go ahead and close the PHP. So angle bracket question mark PHP starts it. This is going to close it.
William Rosener: Okay, so what am I going to do is I just want to take a look and get the base name off this document, and I'm going to store that in current found him.
William Rosener: Now I've got an echo segment that's just going to simply display to the screen. What's it going to display the text current phone. And then what's in the variable current file name than a line break. So let's go ahead and save that will take a look. I'm going to upload that
William Rosener: And we'll take a look here, hit the refresh. And sure enough, it's get an alabama dot PHP as the current file name, what I want to do is extract that and get just Alabama.
William Rosener: Okay, let's do that. Let me go ahead and grab a little code here and I'm gonna come right over here and paste
William Rosener: Okay, so what I want to do is I'm going to find out the position of the period. And then I'm going to extract all the characters to the left of that.
William Rosener: So what this is going to do, it's going to find the string position looking in current the variable current file name, looking for a period, and I'm a stored in a variable called period.
William Rosener: Then I'm going to display the text period, along with what's in the variable. So, if I take a look here, these two things are. This is a comment that slash slash
William Rosener: So if I take a look at Alabama dot PHP starts in position 01234567 some to find the period and position seven. Let's go ahead and check to make sure I'm going to go ahead and upload this
William Rosener: Take a look in my browser and hit refresh. And sure enough, it is found the period in position seven
William Rosener: Okay, now I can find the state name.
William Rosener: And I've just added
William Rosener: These two lines right here. What am I gonna do I'm gonna take a sub string, I'm gonna be looking in Alabama dot PHP starting position zero stopping that position seven
William Rosener: So in effect, I'm gonna be grabbing this information and I'm going to be stored in a variable called state name. Then I'm going to echo the string steady state name, along with what's in the variable state name that aligned break. Let's go ahead and save that.
William Rosener: And upload and hit refresh. And sure enough, I'm getting Alabama.
William Rosener: Okay, let's grab a couple more, a little more information here.
William Rosener: Okay, now I want to know the image name and the image data and again I am storing this with some of them were looking in the current folder.
William Rosener: And a folder called state information and then I'll be looking for Alabama Dot jpg THEY DON'T BE LOOKING FOR Alabama data dot txt so if I just take a look here. Come back. I'm gonna look into in state information Alabama data dot txt and Alabama jpg
William Rosener: Okay, let's go ahead and save this and
William Rosener: We'll go ahead and just get some more debug statements is all it's going to happen.
William Rosener: And let's go ahead and take a look at that, Alabama, and here's our image name is going to be looking in the folder state information, Alabama. Dot jpg and then the data estate information Alabama data dot txt. Okay, so we've got everything now we just need to display it.
William Rosener: Okay, so let's come along and display it. And this actually this echo statement. We're going to leave in here.
William Rosener: This is actually going to display i n g is the image source image name. And that's going to be like looking in state information, Alabama. Dot jpg
William Rosener: We're going to display for the all tech state name the width and the height and the reason I've got these slashes is because if you want double quotes inside double quotes. You've got to proceeded with a slash. So that's what this lashes are for this. Go ahead and I say that
William Rosener: And I'll go ahead and upload that. And at this point, we should hopefully have an image. And sure enough, there is our image. I'll tell you what, at this point, I'm going to go ahead and comment out this here five lines up above there.
William Rosener: Okay, just put in those slashes. So they're still on the curb. I'm just gonna go ahead and comment about
William Rosener: Okay, this one, we need to live because this is the one that's actually going to display the real image there. Let's go ahead and I saved this one more time just to make sure everything's looking good. I'm gonna hit
William Rosener: Upload Alabama.
William Rosener: I'm going to refresh. And sure enough, here's what we've got now what I want to do is get that text.
William Rosener: And that's just simply I'm going to include
William Rosener: Image data.
William Rosener: Today, but maybe I'll grab a paragraph break there too.
William Rosener: Okay, so this is going to be included information in a file. So I'm going to echo a paragraph, Rick.
William Rosener: Then I'm going to include the information, an image data which is state information like Alabama data dot txt let's go ahead and save this.
William Rosener: I'm gonna go ahead and upload it.
William Rosener: And refresh and great. Okay, so what's going on is, we've got our header and again if I want to change that. So right now, we've only got one document so won't be too impressive here so
William Rosener: I would modify header. If I wanted this information to change. And this would be modifying footer. But notice this information. Nowhere that document.
William Rosener: In this section, am I actually haven't even hard code, hey, go look for Alabama jpg or go look. The data I'm simply using the file name to determine what information goes in this file here.
William Rosener: OK, now let's go ahead and probably the easiest way I'm gonna hit control. A to select all Alabama's finished I'm hits up, Control C or edits copy
William Rosener: And I'm gonna come right up here to File, New, I'm gonna take a look here. The next one.
William Rosener: Is Alaska.
William Rosener: File, New, I'm going to paste and listening to make two little changes. I'm gonna come right up here to Alaska.
William Rosener: And Alaska.
William Rosener: Everything else is going to take care of itself. Okay, now we're going to go ahead and save this.
William Rosener: Make sure you give it PHP.
William Rosener: Alaska dot PHP and save. And let's go ahead and take a look at it. I'm gonna come up here to view refresh. Here's the last camp upload that
William Rosener: And I'm going to come back here.
William Rosener: Refresh. Here's the last game. And sure enough, that's working perfectly in there. Okay, one last one.
William Rosener: Shot may have you guys do a few more. Go ahead and hit control a control see
William Rosener: I'm going to come up here to File, New,
William Rosener: I'm the paste
William Rosener: Arizona.
William Rosener: And Arizona.
William Rosener: Make sure I'm not, I could have actually did a convert to lowercase here and maybe should have. I'm going to save this as but notice I'm giving these the file name all lowercase.
William Rosener: Arizona.
William Rosener: dot PHP, so like I probably should have, but just if you put these in lowercase, then you'll be fine. Now, Arizona dot PHP. Let's say that
William Rosener: Okay. Then we'll go ahead and upload that some of you refresh. Here's Arizona. I'm going to right click upload it.
William Rosener: Come back.
William Rosener: Refresh and take a look in there is Arizona. So again, the big thing here is
William Rosener: If tomorrow. I want to change this phone number.
William Rosener: I'm just opened up a follow here today. I can
William Rosener: Let me just open up the folder here and let's say I just want to change this to 1235. I'm going to go ahead and save it.
William Rosener: I'm going to go ahead and upload my footer.
William Rosener: I'm gonna take a look refresh this
William Rosener: And sure enough, 1235. So again, that's the power of the include statement. So in this case, if I need to, if I've got hundreds and thousands of documents.
William Rosener: If I ever want to change the header I modify one document if I want to change my footer.
William Rosener: I modify one document and this was really powerful, you're going to find yourself using this over and over, maybe not.
William Rosener: On the name of the file. Maybe it's the title something else, based on that, we are going to include information. Some. So again, in this case, I simply looked of this five minutes with Arizona dot PHP.
William Rosener: Let's go ahead and include this image and this text. Well, hopefully. In this video, you'll learn how to do what I can consider probably the most important topic in this class. And that is, including information from other files or catch the next video. Thanks. Bye.