Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
We are now going to build a template page for our website to use as a base for any additional pages we need. And this template page is going to use a concept of includes, to pull in our header image, and our footer image. Let me show you the header image, and that is the file named header scuba. If I open this up, what I actually have on this page, is 2 div tags. So I've added the div tags within the include file.
So this is all being based on CSS. One is called the header, which is pulling in our header image for the website. The second div is pulling in our nav bar information. So what this page looks like is this without the CSS. Now, all of these navigational pieces, all of these hyperlinks, once we get them onto the main template page. We'll pull in the CSS file and they will be formatted that way. So, they won't look like they do now, in Default view once we actually get them on our template page.
So that is our header scuba, that's the page we want to pull in. So lets open up the template page to do it. Now, our template page is simply a div tag with some page content. So, we have our div tag here for the main content of our page, that's going inside a div called main. So the header include goes above it, the footer goes below it. So, let's go ahead and add this. Now, we need a PHP code block in order to add this, so I'll go up to the PHP tab, click on the Code Block, and Ill add some space in here.
As I said, you don't have to do that, but I think it makes it a little quicker to read, if you need to modify it later, and it'll also make it easier for you to see what I'm doing. So, we need an include parentheses and a semicolon, and I'm going to do that same thing. I'll just copy that code and paste it down in the footer area, that's kind of the skeleton of our code for an include. Now, it's simply a matter of putting the name of the file inside a single quote. So headerscuba.php goes in the header area, and footerscuba.php goes in the footer code.
So, I'll put that in a single quote, and then we're going to put header scuba.php. Now, in Dreamweaver CS5 and 5.5, when I add one single quote, it adds another. If you're in an older version of Dreamweaver, you just need to add both of them. This include here, we're going to do the same thing. This one's going to be footerscuba.php, so you can see it's not that difficult to work with includes. We'll save this file, and let's go out to the browser and make sure it's working correctly.
And there it is, now I don't have much space in here for the page content at this point and time, so our page looks rather silly but as we and page content into this middle section it's going to move our content down. If I go out to design view you'll see it looks identical. And I can open this up a little bit to plug in some code here, and let's put it into live view. My page is having a bit of an issue here because my main div is inside and you can see my closing div for that main.
This main is pulling in a page background and a right border property. So, what I need to do if I want everything included in that, I need to move this closing div tag to a different location. So, you do kind of have to coordinate your CSS along with your PHPPs in order to work with it. Let me move things around the way they should be, I want all of my middle content to go within this main div.
I'll move it down there, let me move my footer comment. Now, this if I move it into the PHP code block, notice I get an error, this is actually an HTML comment. So, this comment should go outside our PHP code block. It can get a bit confusing working with comments initially. So, all HTML has to go outside the PHP block. And I'll pull up my P tag, organize this a little bit better.
Let's get that pulled up. This NBSP this is simply a space. So lets see what our page looks like now. I'll Save this, put it in the Browser, and its completely fixed. So, you must coordinate your CSS pieces along with your PHP code and now I won't have a problem as I add content. To test that out, let's put it into deign view and what I will do is add some information in here. Now, you can see clicking around in here is a bit of an issue, I can't get my cursor in this area.
And I want to point this out now, because it's easy to have this occur. I am actually still in Live view, you have to manually move out of Live view, so I can't edit or do anything in the view. If I click Live view again, you can see it has this little bit of shadow. If I click it again, I have no problem getting my cursor inside this area, and you can see as I move my cursor now, I have no problem with my Page Layout.
So I'll Save this page, we will have some extra paragraphs within here. So, let me back that up just a little bit, so we don't have quite so many, when we go to add content. And there's our New Template page, the basis of all of our pages throughout the website.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 101535 Viewers
61 Video lessons · 88293 Viewers
71 Video lessons · 72166 Viewers
56 Video lessons · 103921 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.